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 Local WordPress Development Local WordPress Development Installing WordPress Locally

caroline
caroline
6,974 Points

Problem migrating live Wordpress site to MAMP

Hi - I am having big problems trying to get my live Wordpress site set up on my Mac using MAMP. I have installed MAMP, and I know that it's working as I can access the MAMP homepage at localhost:8888/MAMP. I also managed to install a brand new, fresh Wordpress site at localhost:8888/mynewwpsite and that also works fine.

I'm pretty sure I've isolated it to a problem with importing the sql database. If I transfer all my WP files in my live public_html folder to the MAMP root folder using FTP, without importing the database, and then access localhost:8888/mysite/wp-admin, I get the message 'Error establishing a database connection', which apparently is a good thing because it means that "the PHP interpreter has successfully run WordPress and attempted to connect to the database. Since the database does not exist yet, you get that error" (as suggested in this article http://egalo.com/2012/05/15/clone-live-wordpress-to-local-env/).

Also, at this point if I insert a test.html file in my root folder, and I then go to localhost:8888/mysite/test.html, I can see it. So far, then, everything appears to be working.

I then export the database using phpMyAdmin via cPanel, and then import it using the phpMyAdmin link on the MAMP page. (I'm 99.9% sure that I am doing this process correctly, so it's not an issue there.) After the export/import process, I update and save the wp-config.php file with the following settings;

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

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

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

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

as, instructed pretty much everywhere. However, this is where it goes wrong. I go to my browser and get a message saying "This webpage is not available. Google Chrome's connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured." (Or the equivalent message in Safari / Firefox.)

Basically, it appears that for some reason, importing the sql database from my live Wordpress site stops my browser from accessing the local server. I really can't understand why. I wonder if it's a similar problem to this: https://teamtreehouse.com/forum/error-importing-database-from-local-to-live-server-error-1881, but I don't know how to check. I'm pretty new to all this, so if anyone with more experience can help I'd be really grateful. I've spent hours trying to figure this out!