Quantcast
Viewing all articles
Browse latest Browse all 5527

thephilm on "WP development locally - Error establishing a database connection"

Have you verified that the db imported successfully?
Check https://dev.mysql.com/doc/refman/5.5/en/getting-information.html for a few of the commands (though it looks like you already have a good grasp on that). Also - be good to make sure there are no restrictions with root access to the db.

It might even be worth writing a small php script to make sure to isolate the issue outside of wordpress.

<?php
$username = "root";
$password = "";
$hostname = "localhost";

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
  or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
?>

Use this to make sure you can at least connect properly to MySQL.

Then -

<?php
//select a database to work with
$selected = mysql_select_db("yourdbname",$dbhandle)
  or die("Could not select examples");
?>

Use this to make sure you can connect to the actual database.

If both are successful, then you may want to recheck the wpconfig again for extra spaces etc.


Viewing all articles
Browse latest Browse all 5527

Trending Articles