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

WP: "Error establishing a database connection"

I completed the Extra Credit task: Uninstall 1-click WP install and then try the manual 5-min install. I deleted the database and overwrote the old WP files on the server with the new install. I also set up a new database in CPanel. When I tried to get back into WP-admin area I got the above message. I then tried to fill in the DB fields in the WP-Config file, but I don't know what the 'localhost' is supposed to be? I have a web hosting with WebHostingforStudents. I've emailed support in CPanel, but no response as yet? Can anyone advise what I'm doing wrong?

Mate Maksan
Mate Maksan
2,395 Points

In CPanel you should add database, user and connect/add user to that databese. In config file you have to add database name, user and password. DB_HOST should stay 'localhost'.

/** The name of the database for WordPress */
define('DB_NAME', 'database name');

/** MySQL database username */
define('DB_USER', 'database user');

/** MySQL database password */
define('DB_PASSWORD', 'password');

/** MySQL hostname */
define('DB_HOST', 'localhost');