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 Local WordPress Development Local WordPress Development Installing WordPress Locally

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.

Travis Granger
Travis Granger
2,745 Points

So I'm also getting this error but i think it's because my wp-config.php file was already created.. let me explain. The way I'm aiming to do this is marginally different from Zac's instructions. I did not download wordpress.org but instead used FileZilla to FTP my current wordpress site to my desktop and moved those files into the localwp.com folder. The implication is that my wp-config.php file was already generated and already had a DB_NAME, DB_USER, DB_PASSWORD established. What I'm wondering if if I can (or should) delete this wp-config.php file and then (try to?) recreate it via the video's instructions to enable me to operate on my local machine.

Is this going to cause me major pain / issues down the line or will it not matter as long as I only FTP updates (and not the wp-config.php file)? Your help is greatly appreciated. I've spent >1 hr to get this far...