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

Tracy Excell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tracy Excell
Front End Web Development Techdegree Graduate 15,333 Points

How to get a second wordpress project operating under MAMP in the same file?

Hello,

I have completed the wordpress basics course and I am wanting to have another go at making a second wordpress site. I have created a second folder and added the wordpress files to this. When I go through the wordpress start up wizard for this site I get:

Error establishing a database connection 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? If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

Are you able to have more than one site operating locally? Does anyone know what I could be doing wrong here for the wizard not to work? I have generated new usernames etc so am not sure what to do next.

Thank you.

2 Answers

Hi Tracy, are you running the free version of MAMP or MAMP Pro? With the Pro version you're able to run multiple local instances (hosts) simultaneously. Otherwise, you'll have to switch your root directory every time you want to work on a different site. MAMP Pro is a worthwhile investment for many reasons, but that's a huge one.

You're very welcome!

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Hi Tracy,

What I do for multiple dev sites locally is just create a separate sub folder to the document root. If your doc root is htdocs then when you type localhost in the browser, your root is htdocs. So, I create a bunch of folders in htdocs - like htdocs/site1, htdocs/site2 ... and so on. Then to use your site, you just need to add the site name after local host - as in localhost/site1. In fact I just leave the default stuff in the doc root.

You can always create a virtual host in apache to point localhost (or any name you'd like - site1.com for example) - worth knowing how to configure apache and look into virtual hosts with MAMP when you'd like.

For me, just adding my sitename to localhost work great. To install another wordpress site, you just copy the wordpress folder (with wp-content and stuff) into htdocs, rename to your new dev site (like site1) go to localhost/site1 in your browser and start the 5 minute install (of course you need to have to database stuff setup).

-- After looking at your question again - it looks like you are having a database issue, not a folder issue... Remember to create a new database for the new site, along with a database specific user that has privileges to the database (if using phpMyAdmin then go to the database and add user account in the Database/Privileges tab). Then you need to know the Database name, User name and Password for the install.

Hope that helps.