April 25, 2016
Error establishing a database connection is my least favourite error message. There’s so many things that you need to check, and the error itself (imo!), does not provide very much direction.
Fortunately, there are already lots of guides to help point you in the right direction. WP Beginner breaks down all of the items you should be checking out if you run into issues setting up / launching a site.
You can also use this handy function to test if the information you’ve entered into wp-config.php is accurate. It’s mentioned in the above article, and you can see more examples here.
<?php // place me in a test.php file at the root! $link = mysql_connect('localhost', 'root', 'password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?>