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 How to Build a WordPress Theme Content Strategy with WordPress Installing and Setting Up WordPress Locally

The instructions for getting Word Press to work locally don't work...

I followed the instructions explicitly, and this is the message that I get:

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.

4 Answers

I got it to work. Thanks for your concern.

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

Daniel Luke can you post the solution here so that other people can learn from your question please!!!

Well, I'll try...I assumed from watching the video that 'root' (without the single-quotes) could be used as a default username and password to connect to a MySQL database when setting up WordPress. But that apparently isn't necessarily so. Therefore, if you receive the "Cannot connect to database" error, make sure that the database username and password that WordPress calls for on the setup screen actually matches the username and password that you are using in MySQL.

So, this brings up the question, "how does one change such settings through phpMyAdmin?" First, you would need to have phpMyAdmin running. To do this, start up your WAMP, your XAMPP, or your MAMP (three versions of essentially the same thing--one for computers running either an Apple or Linux operating system, MAMP, the other two more commonly used for Windows. If you click on the control panel for one of these services, you should see a link to phpMyAdmin. If you click on it, you will be brought to the home page of phpMyAdmin. On the left side off this page, you will see a grey column that takes up about 20% of the width of the screen. At the top of this grey column you will see a drop-down which, if you have any databases with tables, will display the following default text, in parentheses (more or less as shown): (Recent tables...) About 1.5 inches to the right of this text is an inverted triangle referred to, in the parlance of developers, as a "drop down arrow".

Below the the aforementioned drop down, you will see a list of databases if there are any. I had once thought that to adjust the permission settings for a particular database, one would need to click on one of the databases listed below. Such is not the case.

What you must do instead is click on the tab which reads "Databases" (the text is shown without quotes and is to the right of a cylindrical icon--the universal visual symbol denoting a database). The database tab can be found to the immediate right of the column in grey abutting the far left margin of the page. For the purposes of locating it easily, I will mention that underneath the Database tab, you will see the heading "General Settings", and to the right of the Database tab, you will see in capital letters "SQL", without the quotes,. Above the tab you will see a series of numbers, per chance.

Once you locate the tab, click on it. All that you need to do from there should be self-explanatory.