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 Make a Website with WordPress Installing WordPress The Famous 5-Minute WordPress Install

Elizabeth BABYCH
Elizabeth BABYCH
6,993 Points

I'm stuck at the Wordpress Setup Configuration Page, it reads "Error establishing a database connection"!

I enter mySQL database/username/password to "...com/wp-admin" and it reads: "Error establishing a database connection"!

(For a clearer idea, it's at the 6 minute mark of the video "The Famous 5-Minute Install").

I have gone over everything several times and I am not getting anywhere. Is there an obvious solution? I have copy and pasted my mySQL database/username and I've even created a new password after a few attempts, and then tried. Nothing is working.

What do you think?

7 Answers

I see that webhostingforstudents offers a one click install for wordpress. Maybe you can install it from their c-panel?

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

Yes you can, but you will want to delete the files you had already uploaded though first.

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

Yes you can, but you will want to delete the files you had already uploaded though first.

Elizabeth BABYCH
Elizabeth BABYCH
6,993 Points

IT WORKED. Thanks so much Geert-Jan and Zac!!!!!(‐^▽^‐) It must be something that I entered incorrectly with my database/username/password, etc... (but, I'm not going to try to figure that out for a few days at least). I'd like to be able to do the Five Minute Install in the future, but I'll see how much I can edit with this. Does this mean I can't edit the CSS/html and then transer through filezilla?

Ah, you don't need XAMPP or MAMPP since you are installing wordpress on a webserver. Wich hosting company are you using? You could test if the information you entered is correct. Create a new file named test.php en paste in the following code:

<?php
$server   = "localhost"; //replace this
$database = "database"; //replace this
$username = "user"; //replace this
$password = "password"; //replace this

$mysqlConnection = mysql_connect($server, $username, $password);
if (!$mysqlConnection)
{
  echo "No connection.";
}
else
{
  echo "Connection";
}
?>

Fill in the information you have entered in the wordpress setup. Load this file up to your domain en access it through the browser (http://yoursite.com/test.php). What do you see?

Elizabeth BABYCH
Elizabeth BABYCH
6,993 Points

Geert-Jan, Okay, when I do this it reads: "No connection" (I can keep my server as "localhost", right?)
I have a domain through GoDaddy.com and hosting through WebHostingForStudents.com. Do you think its something wrong with the set-up of my hosting account? Thanks so much for helping through this.

if you are sure that you have a database set-up, the only thing I can think of is that some of the information you have entered is wrong. Are you sure your password, username etc. is correct?

are you installing wordpress local or on a webserver?

Elizabeth BABYCH
Elizabeth BABYCH
6,993 Points

Locally, and after reading a lot of help forums, I followed instructions on editing my wp-config-sample.php, and afterwards uploaded it as wp-config.php, but when I go into my site's .../wp-admin, the error that comes up is the same: "Error establishing a database connection"

Andrew McCormick
Andrew McCormick
17,730 Points

Lizzy, did you make the new blank database in phpmyadmin before trying to install WP?

Are you using MAMPP or XAMPP?

Elizabeth BABYCH
Elizabeth BABYCH
6,993 Points

Hey Geert-Jan, The thing is, I don't think I've gotten to that part yet. So far this part should be really really easy: get the domain, point it to the hosting site, FTP the wordpress files with File Zilla, set up the MySQL database, and thennnnnnn set up the wordpress database (installation script) through ...com/wp-admin.
Since this isn't working, I can't access my wordpress admin account, and I did everything exactly like how the video taught me. Since then I've watched it at least five more times.

Elizabeth BABYCH
Elizabeth BABYCH
6,993 Points

My Hosting site emailed me today to try to resolve the earlier problem and they said "When we logged into cPanel we did not see any databases for your account. Are you seeing databases and users for that database?" After doing the 1-click install, my mySQL database has change from "serasena_kovicz" to "serasena_wp387". I wonder if this was the issue all along...the first database wasn't right somehow?