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!
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
Error establishing a database connection
I keep getting this message when I try to go to me "mysite"/wp-admin
"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."
Derek Shanks9,543 Points
I'm glad you got it figured it out.
I thought I would throw this out there for others who run into issues. There is an awesome set of tools offered by Bitnami. They have built virtual hosting systems that are preconfigured. It eliminates issues of multiple MySql instances. These stacks also keep out of your main computer. They have stacks for other environments as well. Ruby, PHP etc. They're all free.
This is the Wordpress stack. https://bitnami.com/stack/wordpress
Viraj Kokane17,531 Points
Please never forget to mark any answer as the Best Answer on forums if you are satisfied with the answers you got. As doing so appreciates the Answerer.
I think the first step would be to check out the wp-config.php (in the root of your Wordpress directory) file and see what details are used to connect to the database. Compare that to the username, password etc of your actual database and make sure they're the same. If that doesn't work, I'd backup the wp-config.php file you have and replace it with a fresh one from a new install. it should prompt a install screen to connect to the database, or you should enter the database detail in again manually.
You can see here how it should look: https://codex.wordpress.org/Editing_wp-config.php
Thanks for your answers.
I just deleted everything and restarted. It seems to work ok now but when I go to my wp-admin page it comes up with my Dashboard rather than my config set up.