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

Dawn Sargent
Dawn Sargent
142 Points

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

john paul
john paul
3,191 Points

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'.

Adrian Orta
Adrian Orta
30,490 Points

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

Example: localhost:3307

Micah Dunson
Micah Dunson
34,368 Points

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.

tayjoh
tayjoh
2,329 Points

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/
katie tabor
katie tabor
318 Points

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

katie tabor
katie tabor
318 Points

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?
Joel Porretta
Joel Porretta
5,079 Points

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.

Julian French
Julian French
3,257 Points

Did you ever find a solution?

John Lott
John Lott
5,459 Points

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

alan ingram
PLUS
alan ingram
Courses Plus Student 3,979 Points

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