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 trialDawn Sargent
142 PointsCan 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
3,191 PointsI 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
30,490 PointsThe easiest method I've found is writing the port number that your database is being hosted on after 'localhost'.
Example: localhost:3307
Micah Dunson
34,368 PointsI 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
2,329 PointsConfirmed! Thank you for the help Micah!
Martin Zarate
10,723 PointsHere 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
318 PointsHey Dawn, I am having the same problem, just wondering if you got any tips on how to resolve this issue?
katie tabor
318 PointsThis 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
5,079 PointsI'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
3,257 PointsDid you ever find a solution?
John Lott
5,459 Pointslocalhost:(port number) works for me too. Thanks guys!
alan ingram
Courses Plus Student 3,979 PointsYes the port needs to be appended to the database. Likely localhost:3307