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

Can't select database

There is no explanation in the video about how to create a wordpress database when using Xampp. I'm sure that is the reason for getting the following error when trying to install wordpress locally...

"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?"

Any advice is very appreciated.

Hi Michael,

It would be up to you but because of the differences between installing on a mac and installing on a windows (im on windows) I wrote a quick PDF I could send you it has a full walk through of the process needed to get wordpress installed locally and up and running with database's and users.

Also handy to have for reference to,

Let me know if you do!


2 Answers

Darren Healy
Darren Healy
Front End Web Development Techdegree Student 23,565 Points

This will help as a start: http://teamtreehouse.com/library/local-wordpress-development/local-wordpress-development/installing-a-local-web-server-on-a-pc

Then, when you think you are at the stage of creating a database. Run Xampp with administrator rights, start Apache and MySQL, then click on the MySQL admin button which will bring up the PHPmyadmin view. This is set up in the same way as it is in the Mamp videos.

This is definitely covered as I've just learned it myself last week and have reviewed the section several times to make sure I'm doing it right.

Hope I've helped!

Emeka Okoye
Emeka Okoye
2,489 Points

To install WP locally using Xampp, first create your database using PHPMyAdmin. You can call your database anything you like...

When you run the installation in the browser, enter the database name you created, for the username enter 'root', leave the password blank and accept the other defaults.

In the end your config.php should look like this:

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

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

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

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

I hope I've answered your question, if not let me know.