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

Larry Wright
Larry Wright
7,325 Points

Installing and Setting Up WordPress Locally

I am setting up Wordpress on localhost using Xampp on my PC. Yesterday I was asked for the database name, database user, password, and localhost from WordPress. It kept giving me errors in one place saying my wp-config.php was missing and then it would say I needed to find my wp-config-sample.php page. I have never set up the database wp_portfolio. Today, I found that I had a wp-config-sample.php file by itself in htdocs that might have been causing the problem and I took it out. I had my local host up and running and I get to the index window fine. When I click on allisongrayce.com the error below comes up "Error establishing a database connection”. I go to WordPress and it tell me: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? I deleted all of my WordPress files and the allisongrayce.com files, reloaded them and the same “error” message as above appears again. I have my Apache and MYSQL both running. I can never get to my PhpMyAdmin location to set up the database. Is my PhpMyAdmin that I using to set up allisongrayce.com the same as my PhpMyAdmin on my Hostgator web server? I have a Hostgator account where I have a PhpMy Admin window that comes up in my c-panel. I created them a few weeks back under the section on Websites; How to make a WordPress blog; Getting started with WordPress; and then Preparing to manually install Wordpress. I called Hostgator to double check my passwords and the person on the phone said that they don't have them and if I didn't know them to set up a new user and password. I have spent 3 days getting the Xampp and localhost to work and now I am dead in the water again unable to set up my database with PhpMyAdmin. I have read numerous forums and am totally lost on what to do next besides skipping this section and it was the one I wanted to understand the most because I have websites on hold because I didn't know what I was doing. Thanks for any help.

2 Answers

Larry Wright
Larry Wright
7,325 Points

PROBLEM SOLVED! Thank you Jones so much, you are a life saver or should I say a time saver. The only things I did differently was in the wp-config.php file named it wp_portfolio instead of wordpress since I named the database wp_portfolio and when it wants to do localhost/wordpress I changed the wordpress to allisongrayce.com and then it went to the wordpress site, I put in the information per the video and I made it all the way to the dashboard. Thank you so much. You are now my best friend.

Jones Dias
Jones Dias
13,902 Points

I'm glad you solved your problem, Larry! Come on, I just sent you a link, you did the hard work ;) Keep learning everyday. You're more than welcome. Thanks, bro!

Jones Dias
Jones Dias
13,902 Points

Larry,

The local database user is probably "root" and the password should be empty.

Carlos Rubén Jiménez Navarro
Carlos Rubén Jiménez Navarro
12,009 Points

Hello. I have the exact same problem. It doesn´t work with "root". I got this text from it We were able to connect to the database server (which means your username and password is okay) but not able to select the wp_portfolio database.

Are you sure it exists? Does the user root have permission to use the wp_portfolio database? On some systems the name of your database is prefixed with your username, so it would be like username_wp_portfolio. Could that be the problem? If you don't know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.

Does anybody know how to set it up step by step for xampp? Thank you in advance.

Larry Wright
Larry Wright
7,325 Points

Right now I can't move from the index where I click on allisongrayce.com and it takes me to WordPress, instead I'm directed to the error message mentioned above. I did figure out how to click the admin button on Xampp and take me to my PhpMyAdmin to put in the wp_portfolio database but I can't get to the page in WordPress. From what I understand I go to localhost, see the index and allisongrayce.com; click on allisongrayce.com, it takes me to WordPress; then I go to PhpMyAdmin and create the wp-portfolio; and then back to WrdPress for all the database names, users, and passwords; then run the install; and then some more info for site title. My inability to pull up WordPress is presently my biggest problems and I am concerned about thenames, users, and passwords after that. Thanks for your help! Much appreciated!

Carlos Rubén Jiménez Navarro
Carlos Rubén Jiménez Navarro
12,009 Points

I still can´t pass the Wordpress database details either so I think I´m going to keep working live instead of locally. Right now it seems much easier. Good luck Larry and thanks Jones. Best wishes.

Carlos Rubén Jiménez Navarro
Carlos Rubén Jiménez Navarro
12,009 Points

Thanks a lot. I decided to reinstall xampp and folowed the link you gave me and it worked! Thanks a lot. Let´s see hot it goes now. Best.