Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress Local WordPress Development Local WordPress Development Installing WordPress Locally

Vincent Bellittera
Vincent Bellittera
20,411 Points

Looking for help setting up my database for wordpress

Hi everyone. I am trying to configure my database for xampp localhost. I get a error that says:

Can’t select database We were able to connect to the database server (which means your username and password is okay) but not able to select the localwp database.

Are you sure it exists? Does the user wpuser have permission to use the localwp database? On some systems the name of your database is prefixed with your username, so it would be like username_localwp. 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.

Please help!

9 Answers

Did you setup a user for your Database in phpMyAdmin? Try using the username 'root' with no password.

Vincent Bellittera
Vincent Bellittera
20,411 Points

yes I did set up a DB name, user pass. and a table prefix. Should I still try... I was thinking about uninstalling xampp and reinstalling. Maybe I didn't check one of the boxes when I set it up??

I'm gonna try the 'root' with no password now.

Kevin Korte
Kevin Korte
28,135 Points

Make sure in your phpMyAdmin that your database user you set up has full rights over the database you also set up.

Vincent Bellittera
Vincent Bellittera
20,411 Points

My user has full privileges. Is there somewhere else in phpadmin that I have to go to make sure?

If you go to privileges in phpMyadmin and Add user. In there set your username and set the host to 'localhost' and then a password. Then as Kevin said you need to make sure you set all the privileges for that user.

The username 'root' is the default user already created in phpMyAdmin.

You do not need to reinstall xampp :)

Vincent Bellittera
Vincent Bellittera
20,411 Points

You guys will never believe what I did!!! I put wpuser as the database name,,, so I had to put DB name: wpuser user name: wpuser

LOL

Thanks for the quick responses to my unnecessary question guy's, I really appreciate the help!!

Haha glad you sorted it :)

Vincent Bellittera
Vincent Bellittera
20,411 Points

Is having the same name for the DB name and username going to conflict with anything... should I change the DB name?

You can change it if you want but in a local environment it really doesn't matter. I would not recommend it in a live version though., lol