Error Establishing Database Connection with Wordpress in MAMP - database

I have a few local Wordpress sites already running in my folder for MAMP, but when I try to create a new one to go through the install process it is throwing "Error Establishing Database Connection".
I know there is not a wp-config.php file setup, but I thought this first step was going to create one?
I have tried both Wordpress 5 and 4 to see if the version isolates the problem.

I had the same problem but solved it by going into the wp-config-sample.php file and renaming it wp-config.php. Then I changed the file contents to the database name I set up in MAMP and the username and password to root. I was then able to open the project.
For reference, I used this video: https://www.youtube.com/watch?v=iIxbv4n5jgQ

Related

VS2013 LightSwitch Project was OK now won't build. (Machine has been moved onto domain)

Lightswitch solution with an external database was able to be built and debugged.
It has lain dormant and in the meantime the development machine and myself have moved onto a domain.
Now an attempt to build the solution gives:
Error 15 An error occurred while establishing a connection to SQL Server instance '(LocalDB)\v11.0'.
Login failed for user 'MyNewDomain\MyNewUserName'. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v4.0\Microsoft.LightSwitch.targets 160 10 TrueTrackLightSwitch2013
It seems I need to tell (LocalDB)\V11 about a new user (MyNewUserName) but I don't know how to do this.
It also raises concerns in that I want to pass the maintenance of this project to another developer once I get it going again.
The project is accessing data from an external SqlServer 2008 database. This external database holds the Aspnet tables for form based security.
I don't understand where '(LocalDB)\v11.0' comes into the picture
thanks
Bob
Solution was to delete folder as per the steps in the following link.
The delete database step failed for me saying database did not exist.
But I was able to open my project and rebuild it.
MSDN LightSwitchForm Post
The Answer that worked was:
Matt on the LightSwitch team got me running again:
1) Delete the directory at:
C:\Users{your user name}\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0
Note: replace "{your user name}" with the name you logged in with.
2) On your Windows start Menu type in CMD and press enter. When the Command Window comes up type:
cd "C:\Program Files\Microsoft SQL Server\110\Tools\Binn"
then:
sqllocaldb.exe delete v11.0
It will say:
LocalDB instance "v11.0" deleted.
Then open a LightSwitch project and run it and it should then work

Can't select database - Wordpress

When I download a new wordpress from wordpress.org and then paste it into my www folder of WAMP, then create a new database in phpmyadmin, then go to localhost and click the wordpress site, it asks to create the config file, and enter the database details, and i do that correctly, but when I click submit, it says "Can’t select database".
Any Idea why this is?
I already have a local wordpress site that started saying error connecting to database. The config settings are all correct so i tried to download a fresh wordpress site and use it and I cannot even set up a fresh one. I have never encountered a fresh wordpress site not working like this before.
I did a msqldump of my old site so that my boss could put it on his server. Not sure if that is relevant.
Cheers.
Please don't overcomplicate.
In the "Database Host" field add "localhost: e.g. in my case "localhost:3308" solved the problem.
For anyone who's still looking for solutions to this problem - please, check again your wp-config.php database credentials again. I had the same problem today and tried to over-complicate the matter by searching for advanced solutions, while I had a space in my DB_NAME field (was supposed to be 'wpdb' and was ' wpdb').
This space completely messed up my connection, I was even close to reinstalling the whole thing and losing all data.
If using LAMP -
Make sure that all privileges are granted for that database to the created mysql user. Under your MYSQL shell use the below
GRANT ALL PRIVILEGES ON database_name.* TO database_user#localhost IDENTIFIED BY 'user_password';
Where,
database_name = your database name as per wp-config.php
database_user = your user name as per wp-config.php
userpassword = your user password as per wp-config.php
It sounds like either you have not created a database or your wp-config file is not set up correctly. Have you edited wp-config.php file of wordpress and provided correct database name and user credentials. See Famous 5 minute installation of wordpress for details.
It took me way too long to discover that my msql databases were not working on any other websites either. I reinstalled Wamp Server and it worked.
Verify the wp-config.php file.
I had the same error and the problem was related with the quotes:
‘root’ vs 'root'
edit: the correct one is single quote
'
By default
username : root
password : leave it blank
database host : localhost
table_prefix : wp_
For me, the solution was giving wp_user all permissions on the wp_db database.
I achieved this using the command line interpreter (CLI):
$ mysql -uroot -p
MariaDB [(none)]> GRANT ALL ON `wp_db`.* TO `wp_user`#`localhost` IDENTIFIED BY 'pass';
MariaDB [(none)]> exit;
After these operations, I restarted the database:
$ systemctl restart mysql
Of course, the database name (wp_db), username (wp_user), and password of the user (pass) can be different.
my problem was that when I granted permissions to the DB user the host did not match what was in the wp_config.php
/** MySQL hostname */
define('DB_HOST', 'localhost:3306');
I was granting rights with
GRANT ALL ON databaseName.* TO 'UserName'#'127.0.0.1';
This gave me access when I was connected to the local host through ssh but It did not match wp_config.php. so I had to Grant like this then it all worked.
GRANT ALL ON databaseName.* TO 'UserName'#'localhost';
For Mariadb hostname should be localhost:3306 and for MySQL localhost:3308.this fixed my error.
I had this issue when trying to transfer databases between WAMP server installations.
I tried opening PhpMyAdmin on new PC, then got the port of MySql server (:3308) and added this port into DB_HOST ('localhost:3308'). This worked for me.
please create your database with name 'wordpress' before installing wordpress
You may need to create the database yourself.
Visit http://localhost:8888/phpMyAdmin5
create a new database with the name you prefer.
Don't add any table names, just use the name you choose for the database in the WordPress setup

SilverStripe CMS Installation and Development

I am very new to cms and I am wondering if you fine gentleman can help me get started properly. Just a note, I have spent hours researching my questions and I could not find the answer I was looking for.
I have installed silverstripe locally and i started creating my own site with it. Created a new theme, deleted the old 2. It created some random database for me, it was mostly automated. Now I have a server, and I want to put it on my server, but I can't figure out for the life of me how to import it. I was able to install silverstripe and have a default theme (simple) running, but no matter what file I copy or change, it never loads my site. Does anyone has a tutorial on how this is achieved? server is with godaddy.
When I started creating this site, it created a database with a random name, how can I rename that database? What are the files I need to update?
How do I access phpmyadmin locally? localhost:port/phpmyadmin does not works.
1. Site deployment
Here is how I deploy a Silverstripe website to a live server.
ftp into the server
Upload all the files from the development folder to the server
Create a database on the server
Create a database user for the database and add all database privileges
Update the live mysite/_config.php file with your live database username, password and database name
Dump your local database
Import your database dump into your live server database
Call dev/build/?flush=all on your live server
Check the website works
Have a beer
2. Database renaming
The database settings are stored in mysite/_config.php. They should look something like this:
$databaseConfig = array(
'type' => 'MySQLDatabase',
'server' => 'localhost',
'username' => 'database_username',
'password' => 'database_password',
'database' => 'database_name'
);
To rename the database, rename your database in phpmyadmin. Then update your $databaseConfig database name in your mysite/_config.php file.
3. localhost phpmyadmin
Webmatrix does not come with phpmyadmin. You can download it, extract it to your webmatrix html root directory and use it. Or you can download an alternative like adminer, which is a one file database manager.
With regards to renaming your database, see the comments above as they are accurate.
However you still seem to be having problems getting your database out of your local environment, so let's concentrate on that first and see how you go with it.
Note that there are at least two ways you can back up/export your local database:
1). Using phpMyAdmin (Or other web-based DB utility)
2). Using the command line (see the 'mysqldump' command)
You asked about using phpMyAdmin to backup your SilverStripe database so I'll address only 1). above:
As this is specfic to your own development environment and you've not mentioned how far you've got in setting this up locally, nor any error messages you may have received, myself and others can only go so far in helping you out with this.
If you've setup phpMyAdmin as per the installation requirements, it should be installed by default and accessible at this address on your computer:
http://localhost:80/phpmyadmin
The following will also work, as port 80 is the default for most webservers:
http://localhost/phpmyadmin
If neither of these work and you receive a 404, 403 or 500 error (The screen in the browser should tell you which of these has occurred) I'm pretty confident you've not set it up correctly on your system. My suggestion is therefore to go back to the phpMyAdmin docs and re-check you've performed everything correctly as per your own environment setup (e.g. for Linux, OS X, Windows etc).
Once you're setup correctly, have a crack at the DB renaming suggestions above and coe back for more help if you need it.

Creating virtual directory in IIs for dnn website which uses new database

I want to create virtual directory for my dnn website which uses new database, for this I followed these steps.
go to iis server manager right click on site and click on add virtual directory
then I copied all file from dnn site to virtual directory folder and runs on browser it runs fine
after that I created new database and restore the backup of old database(which are used by Dnn website) on it . and change the connection string of virtual directory web.config file, it shows error "Invalid login" then I created new login in sql server and checked db_owner Properties of new database.
but when i browse site one issue occurring "Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects."
so I want to know is these steps are right? if right then, how can i resolve this problem .
If any one have an idea please guide me
Thanks
You will need to update the PORTALALIAS in the restored Database in order to get the site working. Your PortalAlias should match the URL of the virtual directory.

How to establish database connection with CakePHP on Server2Go?

I've been trying to use CakePHP on Server2Go portable server - but for some reason, I'm unable to connect to DB. Moreover, cake flashes some warnings about mod-rewrite.
I have no problems with setting up the same app on XAMPP or WAMPP, also I'm SURE that I'm using the right db details: localhost, root, (no password), and db_name.
Wordpress, drupal, joomla, CI - there are no problems with setting them up to run on Server2Go, but CakePHP is unable to establish DB connection...
What am I doing wrong????
I had to do this:
In the server2go folder there is a file called pms_config. Open it and look for [database]. Below there should be an entry like this
MySQLPort=xxxx
In the Cake db config set host as 127.0.0.1:xxxx where xxxx is the port number from pms_config.
Hope this helps.
You need to enable php_pdo_mysql.dll extension first.
To do that, edit php.ini (into config_tpl dir for Server2Go) and uncomment (remove ; from the start of the line).
Then, restart Server2Go, done!
Be carefull when using old auth method for MySQL users, PDO and/or CakePHP dosent like this anymore!
Then, check the MySQL Port and set CakePHP Database config file to use "localhost:XXXX" where XXX is the MySQL port of Server2Go MySQL Server.
Sucess!

Resources