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 Migrating WordPress from Local to Live Server

William Guth
William Guth
1,570 Points

Migrate from Live to Local

How does one migrate from Live to Local? Opposite of what this video demonstrates. I have had the site up live while following along with this course track, and just now learned how to set up and run MAMP. So how do I bring my live site files down into MAMP locally to work on it?

5 Answers

Simon Duchaine
Simon Duchaine
14,441 Points

You need to create a new wordpress instance in MAMP and then reimport your SQL database and copy your wp-content folder and all it's content.

Also, you'll need to edit the wp-config.php file to ensure that it points to your correct SQL database credentials.

You'll need to change all you URLs in the database (if not your media files and other links will be broken) by using a plugin like Better Search Replace (https://wordpress.org/plugins/better-search-replace/).

Here's the complete guide. https://codex.wordpress.org/Moving_WordPress

Simon Duchaine
Simon Duchaine
14,441 Points

In a way, it's the same thing than moving from local to live. You just need to find a way to FTP to your live environment to extract your WP-CONTENT folder and find a way to export your SQL database.

Maybe you could also use the EXPORT tool in the tools menu. (http://www.wpbeginner.com/wp-tutorials/how-to-properly-move-your-blog-from-wordpress-com-to-wordpress-org/)

William Guth
William Guth
1,570 Points

OK, so I export the SQL database from my live site and import to my local folder structure? Then bring the wp-content folder and its content from the live site to the local folder structure? Then update the wp-config.php file?

Got an error while trying to import the database. "You probably tried to upload a file that is too large. Please refer to documentation for a workaround for this limit."

It would make sense for Treehouse to demonstrate the reverse, seeing as the course begins with setting up a Wordpress site online. Alternatively, they could've began with the MAMP/XAMPP workflow, then went into the relationship between the local and live server.

Feeling bummed, and defeated.

Simon Duchaine
Simon Duchaine
14,441 Points

Hey William,

You've pretty resumed the migration process.

The problem with the SQL database import is because of some server or wordpress configuration (even if you use MAMP, some default config dissalow importing large file).

You can still import a large SQL database using some command lines : https://tommcfarlin.com/importing-a-large-database/.

Also, here's how to change the default config for importing a large SQL using PhpMyAdmin in MAMP : http://www.fatheaddesign.com/808/importing-large-sql-files-into-phpmyadmin-under-mamp/

I would suggest you use the plugins; migrate DB pro, which is a paid service, or use all-in-one migrate which is free but limits you on the size of the site.

mind you, you will need access to the backend of the live site.

Laryssa Kwoczak
Laryssa Kwoczak
750 Points

I'm also trying to do this. I exported the WP database and copied my website's files into the local server folder. I imported the database files into PHPMyAdmin but am getting the following error message when I add my website and localhost information to SQL:

MySQL said: Documentation

1146 - Table 'mywebsite.wp_options' doesn't exist

Please look into the plugin: use all-in-one migrate. This will solve your migrating issues.

Laryssa Kwoczak
Laryssa Kwoczak
750 Points

Thanks, Jacob! That did make it easy to migrate my site. There is just one problem. Most of the images are not appearing, but some are. Do you happen to know how I can fix that?

Simon Duchaine
Simon Duchaine
14,441 Points

Check your images URL. Maybe you'll need to run a search and replace plugin on your wordpress site.

There could be several issues.

  1. are theses new images?

  2. did you clear the cache?

  3. did you look a the dev tools, and view the image? are you having console errors.

Laryssa Kwoczak
Laryssa Kwoczak
750 Points

I ran a search and replace and the image URL appears to be correct. Is there anything else I would have to do?