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 trialJake Porritt
10,356 PointsError 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."
5 Answers
Derek Shanks
9,543 PointsI'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 Kokane
17,531 PointsPlease 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.
rvandaalen
24,090 PointsI 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
Jake Porritt
10,356 PointsThanks 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.
Viraj Kokane
17,531 PointsYou can also upvote the answers.
Derek Shanks
9,543 PointsDerek Shanks
9,543 PointsHow are you hosting your Worpress? On which operating system? If you have installed PHP and say something like MAMP, WAMP, XAMPP there could multiple hosting addresses for MySql database and Wordpress doesn't know which one to use.
The other issue, depending on the install, you may have to change user privileges. First we have to narrow down your hosting conditions.