Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress Installing WordPress Locally Installing WordPress Locally The WordPress Setup Wizard

Can anyone help with WordPress setup? I entered all the host name info like instructions say but I get an error.

After I submit the WordPress setup info for my database it says {"Error establishing a database connection" This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

Are you sure you have the correct username and password?
Are you sure that you have typed the correct hostname?
Are you sure that the database server is running?

If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.}

I have rechecked all my logins multiple times and can not figure out why it's not working.

Dawn

8 Answers

I had this issue too. Its because within phpMyAdmin the database is not at localhost but (in my case) at localhost:8899 you can see this in the top of the page when you click on 'privileges'.

The easiest method I've found is writing the port number that your database is being hosted on after 'localhost'.

Example: localhost:3307

I got stuck here as well. A work around to be able to follow along is to use 'root' as the user and password. Just remember for local development this maybe okay but in production you absolutely need to go back and add or update your db user, password and wp-config.php file to something more secure.

Confirmed! Thank you for the help Micah!

Here is a link that I think will help you:

http://www.wpbeginner.com/wp-tutorials/how-to-fix-the-error-establishing-a-database-connection-in-wordpress/

Hey Dawn, I am having the same problem, just wondering if you got any tips on how to resolve this issue?

This is the error I am getting:

Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

Are you sure you have the correct username and password?
Are you sure that you have typed the correct hostname?
Are you sure that the database server is running?

I've been having the same problem too. Haven't been able to solve it so far. Will post a solution if I find it.

Did you ever find a solution?

localhost:(port number) works for me too. Thanks guys!

Yes the port needs to be appended to the database. Likely localhost:3307