WordPress Error establishing a database connection

Solution:1

Error establishing a database connection doesn’t get any simpler than that. Your password, database name, user name, or host is wrong. See http://codex.wordpress.org/Common_WordPress_Errors#Error_Establishing_Database_Connection

Are you sure about using localhost as the server? Are you using MAMP or WAMP?

Try using Adminer http://www.adminer.org/ on your PC/Mac to find the database name, etc., and to admin the database when needed.

If you know can use a shell, try logging into the MySQL server and trying

mysql> show databases;

to list all databases to check your database name.

And try

mysql> mysqlserverinfo –server=root:pass@localhost -d –format=vertical

to get port info, etc. See http://dev.mysql.com/doc/mysql-utilities/1.6/en/mysqlserverinfo.html

Solution:2

I involved MAMP for the MySQL server, and utilized its phpMyAdmin connection point to make the information base for WordPress and indicate its client and secret key.

Have, for the new data set, was “%” on the “Client” tab of phpMyAdmin, which it said should permit any worth, and allow me to help a specific way through the interaction. Yet, I wound up going into “Login Information” under the “Client” tab in phpMyAdmin, and evolving “%” to “localhost”.

That permitted me to wrap setting up WordPress.

Solution:3

For future perusers, assuming you are on OSX Yosemite (potentially different renditions of OSX also) and get “Mistake laying out an information base association” with a neighborhood WordPress establishment, you might have to do the accompanying:

sudo mkdir /var/mysql
sudo chmod 755 /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Yosemite examines some unacceptable area for the mysql.sock record, so making this symlink to the right area takes care of the issue..

The reason the missing symlink is a problem for WordPress specifically is because in your wp-config.php file, define(‘DB_HOST’, ‘localhost’); will not work. An alternative workaround is to change this value in your wp-config file to define(‘DB_HOST’, ‘127.0.0.1’);.

The OP didn’t express out loud whatever subtleties they changed in their wp-config document to take care of the issue (maybe it was this DB_HOST boundary) so I just idea I’d post this since I burned through a ton of time attempting to sort out it!

Solution:4

I attempted this large number of ideas yet couldn’t motivate it to work. Nonetheless, I had introduced MySQL v8.0.12 and seen that in the ‘Clients and Privileges’ segment, under the client I had set up, the ‘Validation Type’ for the secret phrase was set to some sort of ‘sha2’ setting.

In the wake of attempting 100 distinct things, I at last fixed this by uninstalling then re-introducing MySQL, and during the re-establishment, explicitly picking the choice button that alludes to keeping up with similarity with past renditions of MySQL.

I think this brought about my passwords not being naturally hashed, which empowered WordPress to effectively interface with my MySQL information base.