How to Create a Local Copy of a Live WordPress Site

How to Create a Local Copy of a Live WordPress Site

In Monday’s tutorial on creating a local WordPress site, I said that all WordPress users should have a local installation of WordPress on their PC. One of the key reasons for doing so would be the ability to test design changes without disrupting the live site. I’ve certainly been guilty of fiddling with my live blog and regretting the outcome. If you have also been guilty of carrying out design tweaks on the fly, now is your opportunity to take your experiments offline.

As you now know, creating a local WordPress site isn’t difficult at all – in fact, it only takes a few minutes. But on the face of it, copying an actual live site and moving it offline seems like a far more daunting task. Fortunately, it isn’t. Just follow the simple steps below and you will have an offline version of your WordPress site up and running in no time at all.

1. Activate Apache and MySQL

This first step assumes that you have gone through the process of creating a local WordPress site. If you haven’t, just head over to that tutorial and complete steps one and two. You will be installing Xampp for Windows, and activating Apache and MySQL on your PC. In layman’s terms, you will be setting up a local server that your WordPress installation can sit on.

If you are a Mac user, don’t fear – just complete steps one and two in this tutorial instead.

2. Copy Your Site’s WordPress Files

Now you need to grab your live site’s WordPress files and copy them over to your local server.

Access your live site via FTP. Once there, you want to download all files relating to your site. They will be contained in a root directory such as “yoursitename”.

If you are in any doubt as to what you are doing, look out for a directory containing folders such as “wp-admin” and “wp-content”. There will also be a bunch of files in that directory, such as “index.php” and “wp-config.php”.

Once downloaded, place that root directory into the “htdocs” folder, which can be found in the location where you installed Xampp (by default, you can find it at “C:/xampp/”). If you’re using a Mac and MAMP, follow the same instructions but adjust the local directory to suit.

To check that the files have been successfully transferred, open a browser tab and navigate to “http://localhost/yourfoldername/”. You should see a database error similar to this:

Local WordPress Site

3. Export Your Site’s Database

At the heart of every WordPress installation is its database, and it is not contained within the files you downloaded. So now we need to grab it and install it locally. But before we do so, we need to know which database we are actually looking for. Fortunately, that information is contained within the files you downloaded.

Just navigate to the root directory of the fresh copy of your site located on your PC, and open up “wp-config.php” in a plain text editor. You’re looking for this line:

Local WordPress Site

That is the name of your database – make a note of it.

Now you need to login to phpMyAdmin, which every good hosting provider offers. Here’s where you will find it on cPanel (which the biggest hosting providers all use):

Local WordPress Site

If you’re struggling to find it, contact your hosting provider – they should be able to help.

Once logged into phpMyAdmin, click on the “Export” tab. On the following screen, select the “Custom” export method. You will then be presented with a selection of databases to export:

Local WordPress Site

You only want to export the database that you made a note of above, so click on that one. Ignore the rest of the custom settings, and click on “Go” at the bottom of the page. The database will be downloaded to your PC.

4. Import Your Site’s Database to Your Local Server

Now we want to take that same database, and import it via your local server’s phpMyAdmin. To login, open a browser tab and type in “http://localhost/”. If you are using Xampp, a main menu will pop up, and you will see an option for phpMyAdmin in the sidebar:

phpMyAdmin

If you are using MAMP for Mac or a similar program, you should be presented with a similar screen.

Once logged into phpMyAdmin, select the “Import” tab. From this screen, select the database file that you exported from the live server, and click “Go”.

5. Set Up the Database for Local Usage

The database will now be imported into your local server’s phpMyAdmin. Once that process has completed, click on the “Databases” tab. Your site’s database should now appear in the list. Click on the “Check Privileges” link next to your database:

Privileges

In the next screen, select the “Add user” option. You will be presented with a screen similar to this:

Add User

You can find the user name and password in the same “wp-config.php” file you accessed earlier on. You’re looking for the “DB_USER” and “DB_PASSWORD” variables. The host is simply “localhost”. You do not need to edit any of the other settings – just click “Add user”.

Finally, you need to edit two fields within the WordPress database itself. Navigate back to the “Databases” tab and click on your database name. When you open the “wp_options” table, you’ll see a list of table names like this:

WordPress Database Tables

The two fields you need to edit are “siteurl” (highlighted above) and “home” (which you may need to navigate to the second page to find). Just click the “Edit” buttons next to each field, and replace the URL contained in “option_value” with “http://localhost/yourfoldername/”.

That’s it! If you now navigate to “http://localhost/yourfoldername/”, your site should load up in all its glory. Please note that if you use custom permalinks, you will need to change them to default (in the WordPress > Settings > Permalinks screen) in order for internal links on your site to work. You can of course change the permalinks back to their custom form at any time.

Enjoy!

Creative Commons image courtesy of e³°°°

Tom Ewer

Tom Ewer is the founder of WordCandy.co. He has been a huge fan of WordPress since he first laid eyes on it, and has been writing educational and informative content for WordPress users since 2011. When he's not working, you're likely to find him outdoors somewhere – as far away from a screen as possible!

127 Comments

  1. Atanas

    Works perfectly!!!

  2. Chris

    It would be super cool if when you hit the clone button you would be given some options. I would love to be able to tell it the new URL and have ManageWP rewrite the URL before everything is downloaded. Then click download. It would be even cooler if we could figure out how to actually have ManageWP push the site to a local dev environment.

  3. andrew

    Hi. At the end of step 3 I did not get a list of databases -“You will then be presented with a selection of databases to export:” I instead got a list of tables with WP_ extensions? such as”wp_links, wp_options, etc”?

  4. Saud Khan

    Hi, No database appears in phpMyAdmin, do you have any idea?

    Snap: https://1drv.ms/i/s!AmhvAsyVsvhfbYqm-OkirpuW8k4

    1. Nemanja Aleksic

      Hi Saud, your One Drive picture is not publicly accessible :)

  5. Tony

    Excellent Information, thanks very much.

    As a tip to make things go a little quicker, in CPanel open File Manager and then compress your directories before FTP’ing them to your local machine. They compress “super” fast on the server side and then you just need to FTP 4 file.

  6. elaine

    how can you access your live site via ftp? i have tried filezilla but it didnt work when trying to establish connection

  7. Dale

    Thanks, this was nice and clear and the process was relatively smooth for me to implement.

    The one nagging concern I have is, during construction of a wp site, I expect changes to be recorded in the MySQL DB so those will need to be uploaded at some point. While the process described here was relatively straight forward, I would like know if there was a way of uploading the DB without any editing of the DB? Some way of syncing DB’s…

    Cheers, Dale

  8. Adarsh

    I am getting the below error. Pls reply
    “This site can’t provide a secure connection”

  9. anno1313

    Hi there!
    Thanks to this tutorial my local wp site copy is running like a charm.
    Thanks to author to this wonderful share!

  10. WJC

    Hi!
    Great tutorial. Thanks.

    I was able to solve some issues during installation expet this one. The permalinks are not working properly. All internal links open the XAMPP dashboard.
    This is what I’ve done so far, hower nothing has helped.

    1. Checked the line ‘LoadModule rewrite_module modules/mod_rewrite.so\ in httpd.conf . It was uncommented, so I left it as it was.
    2. Changed ‘AllowOverride None’ to ‘AllowOverride All’ within the default and root directory.

    What I did wrong or is there other solution. I will appreciate any suggestions.

    1. WJC

      and of course I restarted apache.

      1. WJC

        Now I can’t login into the dashboard on the localhost.

  11. Will Johnson

    Works fine … I did get an “Error establishing database” but once I first created a database and then imported data into it, everything was hunkydory!

  12. El Sombrero

    Didn’t work for me either…

  13. Subhashini

    Yeh! After following all the steps I am still getting an error saying “Error establishing a database connection”. Can somebody guide me through what may be the problem…?

    Thanks

  14. Helen

    Great tutorial, all worked fine up to the last step where I was still having trouble connecting to the database. I tried some of the suggestions made in the comments – such as changing user to ‘root’ and host to ‘localhost’ but this didn’t work. In the end, I found a solution here: https://wordpress.org/support/topic/the-infamous-error-establishing-a-database-connection

    I replaced ‘localhost’ with the ip address 127.0.0.1 and voila – my site appeared.

    Still not sure if this is the right thing to do, but its working for now.

  15. David Richied

    Yes! Step 5 is what got me when I was trying to set up my local dev environment. Couldn’t have done it without you! Thanks!

  16. Heber

    Hi Tom, there is no way i could have done this (WordPress on a localhost and download my live site) with out your assistance.
    Thank you very much.
    The next thing I will have to do is upload any updates to the live STUDY site. Have you a tutorial for that also.
    Regards and thanks again, Heber

  17. Miki

    The tutorial was great…. But I can add two thing that worked for me:
    1. If you have PROBLEM connecting with database, solution is to change your (wp-config.php) USERNAME to ‘root’, DB Host to ‘localhost’or use univeral one /** MySQL hostname */
    define(‘DB_HOST’, $_ENV{DATABASE_SERVER});
    and to leave your DB Pass blank like this ” nothing between those and Connecting database problem is gone.
    2. And if you can manage opening your site offline, but you have a PROBLEM with LINKS dont opening ERROR 404, just check in Appache modules “rewrite_module” and your link will come back to live once again
    the solution is on this link http://www.wpbeginner.com/wp-tutorials/how-to-enable-custom-permalinks-in-wordpress-wamp-installation/

  18. Casey @ GetandKeepHim

    Thanks for this!

    I was following your guide and I got the error: “establishing connection to database” and I realized you left out one step which is to ensure the database name in wp-config is the same as the database name in phpmyadmin, which solved the error for me.

    Another thing is to ensure the permalinks structure is set to “Post name” (or whatever structure on your live site) otherwise every page just links back to localhost/xampp.

  19. Mahesh Yadav

    Hi,

    Thanks for your helpful article. It helped me well. There are still some errors which i am facing but i will solve it my end. You solved my big problem.

    Thank you very much.

  20. Csand

    I’m having trouble configuring the local site at step 4 of this tutorial. It seems when I reach step 4 and attempt to import my site’s database to my local host, it gives me error code 1046. Any help here?

    1. WJC

      I guess the solution would be as folllows: create a database first and then import the existing database into it.

  21. Joris

    Thanks for the useful article. Unfortunately, I’m having some weird problems with this.
    In step two, after copying the site files, you say that I should get an ‘error to connect to database’. Well, strangely enough my whole site is up and running.
    I think this has something to do with the config file: it connects with the online (existing) database, so connection is immediately made. When I go offline (by cutting off my WiFi) I can’t make a database connection.

    Now, the real problem is that everything on my localhost links to my live site. So everything I want to do (including logging in on localhost) redirects me to the live site (which I don’t want to do, obviously). I tried changing the database name in the wpconfig.php to ‘localhost’, but then I can’t connect to the database.

    Any idea what I’m doing wrong and (more importantly) how I could fix this?

    Thanks in advance!

    Joris.

    1. Greg

      Having the same exact problem. Hopefully an answer soon.

      1. Al

        change internal link names to local address. refer here

        http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/

  22. Rob

    Thanks for the guide, very useful. One bit of info missing is at the stage of editing the database values. You say “You’ll see a list of table names like this:” however the image shows the contents of the ‘Options’ table. I think the missing step should be something like; “Then click on the table name ‘wp_comments'”

    Regards.

    1. Rob

      … I meant ‘wp_options’.

      1. Nemanja Aleksic

        Thanks for the heads up! I’ve added the “wp_option” step to the article.

  23. gus

    what if i want to do the inverse porccess, i changed a lot of things locally, now i want to publish them on my live site, what should i start with? there are a million post that explain what you explained, but not a single one with the inverse proccess, help

    1. Joe

      I am wondering the same thing. I worked on my client’s site locally and would like to bring over Menu Changes, CSS Changes, Image Changes/Uploads, some Content, and Theme Appearance Changes. I don’t want to affect my client’s orders/customers or anything like that, either. What’s the best route – or should I just manually do those things as quickly as possible? Thanks!

  24. Adam

    If your life changes, we can change the world, too. https://youtu.be/KOA3u6LQXxs

  25. Yole Ajekigbe

    Tom,
    This is to say a big thank you for your publications. I have read some, such as -How to create a local WordPress website in windows with XAMPP; How to upload a local WordPress site; How to move your WordPress website from localhost to live server; etc and I find them all very interesting. You have done a good work and I have benefited a lot from it, though I am yet to try making any website. I think is now high time I made a WordPress website following your instructions . Thank you and regards.

  26. standalone

    Hi, thank you for this tutorial.
    But, what if I want a local copy of wordpress cms, but without duplicating the db?
    Thanks in advance!

  27. Siya

    Thank you! This saved me a lot of time

  28. bubblecom

    Hello Tom, Thank you for this tutorial.

    My real site (and now the local one) is made of 3 folders for language (en, es, fr) all in httpdocs on my computer. Database has been exported/imported and “siteurl” and “home” both change to localhost/en or es or fr in “options). All 3 wp_config files have been modified for DB_host to localhost. Mu only problem when I created the “USER” was with the password. In wp_config, the ‘DB_NAME’ and ‘DB_USER’ are in plain text but ‘DB_PASSWORD’ is cripted. Shall I copy and paste this in the “Create User” password window and then click on “Generate”? because so far, I am still getting “Error establishing a database connection”. Any light in the darkness?

  29. Ade

    I followed this tutorial to the letter, including the changes required to ‘home’ & ‘siteurl’ in ‘wp_options’ but I am having an issue that I hope someone can help with!

    Firstly, I had to manually import my .sql file (DB) as it was too big for phpMyAdmin to cope with, which was not a problem. When I navigated to localhost/mywebsite the home page loaded but all the hyperlinks on the page pointed to the live site! So I changed all the hyperlinks in my .sql file and started all over again. However, all my hyperlinks on every page still point to the live site! (I thought the sql code in the .sql file created the pages?).

    I have 350+ pages on my website but only the home page – localhost/mywebsite – opens!

    When I go into my local copy of WordPress I can see all 350+ pages (so they have imported ok!) but all the pages contain links to the live site but none of these links existed in the .sql file that I exported from the live site because I changed all the links prior to importing the file and I know I didn’t miss any as I did a search and replace and checked for the existence of ‘mywebsite.co.uk’ before running the import!

    When editing any of the 350+ pages in WordPress if I click ‘Preview Changes’ I get ‘Object Not Found. The requested URL was not found on this server’.

    I am very confused!!! HELP!!!

    Thanks in advance!

    Ade.

  30. bsarioz

    I followed the tutorial, but I get a blank page after trying localhost:8888 which is the port where my website locally runs.

  31. JV

    Great tutorial, just the few hiccups mentioned earlier by others. I found the site_url and home fields in the wp_options table, I had to set wp_config .php to use ‘root’ on ‘localhost’ and I had to reset .htaccess by visiting settings, permalinks and clicking on save. Now all is working!

    1. Deadpigsux

      Thank you! I think that you have solved my last hurdle now I can finally get to work on my site.

  32. Dan

    Great article, just did it and it worked a treat. However I couldn’t find reference to the ‘siteurl’ or ‘home’ in the last part and yet my site is still working locally! Either way you’ve made me a happy boy. Thanks.

    1. Dan

      Scrub that, it was logging me into the actual online version of my site. Whoops. Ok, back to the drawing board, sure I’ll get it working soon…

      1. Dan

        Ok, you have to look for ‘wp_options’ and then you’ll see the siteurl and home section. Woohoo

  33. Brad

    By now, isn’t there a software application that can do all of this for me, instead of having to re-configure all of the settings back-and-forth?

  34. Henry Halwell

    You could probably export it all via widget or something, and whip up a shell script to pull them all down but … It’s a lot of work and defeats the purpose of a dynamic website.

  35. matze

    hello thx for the writeup. great stuff. guess that i have to correct and configure the “!The two fields you need to edit are “siteurl” (highlighted above) and “home” (which you may need to navigate to the second page to find). Just click the “Edit” buttons next to each field, and replace the URL contained in “option_value” with “http://localhost/yourfoldername/”.

    othwerwise i get blanc pages

    1. Igor Kolosov

      Yes, you still need to edit these

  36. Emerfan

    This is a really great tutorial, thank you and much kudos!

  37. Aaron

    Hi,

    I followed the instructions and can see my site on localhost, however, some things like posts and other pages did not transfer. Also, my user name and password do not work…

    Any suggestions?

    Thanks,

    1. Davor Altman from ManageWP

      Hi Aaron,

      Posts and pages should have been transferred over with the database, however, it might be a .htaccess issue. Could you please try to navigate to Settings > Permalinks page of the site and click on Save changes – this should recreate .htaccess file and resolve the problem.

      Also, when you cloned the site, if you left wp-admin username and password fields blank, the source wp-admin credentials were used.

      If you encounter any problems, please feel free to ping us at st@managewp.com so that we can investigate thoroughly. Thanks!

      Best,
      Davor Altman

  38. Rimbrogno

    Thanks for the great instructions Tom!
    Although I have tried numerous times from scratch and each time I end up with the same problem!
    Home page (‘localhost/site’) is working ok, but then as soon as I click on a link it takes me to the local/xampp site.
    No idea what I’m doing wrong ??! Any help would be greatly appreciated! Thanks in advance :)

    1. Davor Altman from ManageWP

      I would like to take a closer look at this problem and if you could contact me at davor.altman@managewp.com, we can continue the communication there and resolve this issue together :) I will be awaiting to hear from you. Thanks!

  39. Alejandro Gutierrez

    Dude!

    Your post is a lifesaver. There are a million posts out there but yours was by far the most comprehensive while also being straightforward and simple. I want to thank you for taking the time to carefully explain this process. You’re a total badass in my book.

    Cheers,
    Alejandro

  40. Sandeep

    Great support Tom. Your articles really helped me get going in my new WordPress website venture. Very user-friendly articles.

  41. Gareth Brown

    Great tutorial, clear and easy to understand. I ran into a problem at the end when it wouldn’t work and discovered that I had to change the My SQL host name in the “wp-config.php” file to “localhost” like this: (‘DB_HOST’, ‘localhost’);
    If anyone is running into problems then try this.

    1. Kiwi Foodie

      THANK you! I was wondering why mine wasn’t working til I read this.

    2. Emerfan

      Thanks for posting that, saved me a lot of head scratching!

  42. CK MacLeod

    Just wanted to re-emphasize necessity of re-saving permalinks, at least if you want internal links (ilke menu links) to work well.

  43. CK MacLeod

    Good tutorial, worth being updated. I’d also encourage addition of general comments about the difficulties you may encounter moving relatively large sites, especially ones with singularly large tables. You’ll find a number of posts scattered around the web on that topic, and a number of different tips… and, if you’re like me, you’ll find that none of them work all that well!

    Even as I write this comment, I’m in the process of optimizing and re-optimizing my db, trying to cut it down to size, hoping that this time, when I import the particular problem tables, they will import completely. Then, I’ll see about figuring why other site features didn’t import completely.

    1. Matthew George

      This is an excellent tutorial. With very few exceptions, I was able to migrate a client’s entire production site to my local WAMP instance, and it worked great!

      A few ‘bends in the road’ along the way:
      1. After successfully exporting my production database using phpMyAdmin on the production shared hosting environment, I was unable to import the resulting database using the WAMP phpMyAdmin tool; as I was receiving an ‘unable to load this file because it is too large’ message (my exported file was about 19MB). The workaround — suggested by the phpMyAdmin FAQ link included with the error message — was to use the MySql ‘console’ tool (which is just included in the WAMP installation). First, I needed to ‘create’ a new database, and give it the same name as I looked up from wp-config.php. This is easily done with phpMyAdmin tool on the localhost. After opening the mySql console on the localhost, just give it the following commands:
      Use database-name (where database-name is the name of the database from wp-config.php)
      Source export-filename; (where export-filename) is the full path & file-name of the ‘.SQL’ file I exported earlier.

      My file was imported flawlessly using this method. You can then exit the console-tool, an proceed as Tom directs in his Step 5 above.

      2. If you have trouble finding the ‘options’ table from Tom’s screen-shot in step 5, be aware that most production sites will have an arbitrary ‘prefix’ string prepended to table names. The default string is ‘wp_’. So the table I needed to modify in Tom’s Step 5 was called ‘wp_options’.

      These were pretty minor diversions, and the whole process took less than 30 minutes.

  44. Derrick

    Hi Tom,

    Appreciate the tutorial! I completed your entire tutorial on my MAC and my end result was a completely blank white page. I noticed that I encountered the same blank white page instead of the “Error establishing a database connection” when I initially downloaded and dragged my site’s WordPress folder into htdocs. This makes me thing I’m not downloading my folder correctly or something or other.

    Any ideas or pointers? Thanks a lot.

  45. Victoria

    Changing the values in “siteurl” and “home” options to localhost/yourfilename broke the site – rather, I just changed them to http://localhost and it worked great.

    Also, I don’t have access to phpMyAdmin on my site, but I found a work around by using this plugin to download the database:
    https://wordpress.org/plugins/wp-migrate-db/

    1. Tom Ewer

      Thanks for the tip!

  46. Bello

    I create a wordpress site using localhost but I want to copy it to another difference computer for hosting and other change. How can I copy the file/folder without losing anything, please help me.

    1. Tom Ewer

      Contact your hosting, they’ll be able to help! :)

  47. Nishant Ratnakar

    Hi Tom,

    Thanks for the instructions. I have near got all the steps in. But, I am stuck at importing the database. When I try to import the sql file. It fails and gives me a warning as shown below:
    Warning: POST Content-Length of 10306104 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

    Any idea how to correc this?

    Regards,
    Nishant

  48. IDcreate

    This is a great app I used for some of my WP websites. Still testing the application.

    1. Tom Ewer

      Glad it worked for you!

  49. Lauren

    Hi there!

    This is a great tutorial, simpler than any others I’ve seen. Alas, I still haven’t been able to get it to work just yet. First off, the site I’m trying to copy isn’t one that I made (it’s a lit mag and its designer is long since graduated from this program), so a lot of its ins and outs are a mystery to me. For instance, in the FTP (which I accessed through Cyberduck), there isn’t a folder (and hence a folder name) with all of the site files. It’s the only site hosted there, so the files seem to just…be there. I just downloaded them all directly into the htdocs folder. So I’m confused as to what I should put as the url in the “site url” and “home” options. I tried a few different ones and neither worked. I created a folder within htdocs, and it also didn’t work, or I didn’t have the right url to direct the server to that folder. I also have to keep MySql running on port 8889 because..well, I think it’s cause I was using an O’Reilly book to learn php, and they also wanted you to set up a local server using Zend, and I think Zend must be using the other port, and I don’t know how to get it to stop.

    Any help?

    Thanks!

    Lauren

    1. Lauren

      Hi, so I think I figured out part of it, but even after I’ve gone through and done it all again, I still get the “error establishing a database connection” when I go to http://localhost:81/foldername. Any ideas what might be the problem? The only issue I’ve had is that I didn’t have permission to download one of the logs from my site. Could that be causing the problem?

  50. Ken

    Meant to further explain– it’s our live site’s user login and password for the admin site, created by our hosting service. I’m not surprised that this wouldn’t necessarily work when moved to my local machine. How can this be fixed?

    1. Tom Ewer

      Hi Ken,

      The user login details are encrypted and stored within your WordPress database – they should work fine…

      Cheers,

      Tom

  51. Ken

    Hi, thanks for the thorough tutorial. One of the only things missing is, what about the the WordPress admin site login credentials (not the database — those instructions worked fine). I tried logging in with my WordPress user login and password, it doesn’t work. Does it have to be the ‘super user’ Admin login and password? And/or, is there a file in the site or database where these credentials need to be changed? I searched all the site files and database to see if these are stored anywhere — I couldn’t find them anywhere.

  52. Annukka

    Hi,
    Your tutorial was very helpful, I started with another one, but had problems with getting all the links to work. Your advice on changing the siteurl and home settings in the database was the thing that got everything working for me. Thank you!

    1. Tom

      Glad it worked for you Annukka!

  53. steve

    HI

    Thanks for this, it’s brilliant – I’ve been trying to do this for weeks and now “almost” managed it. Everything fine up to the absolute last step which I’ve replayed below for completeness

    ‘Finally, you need to edit two fields within the WordPress database itself. Navigate back to the “Databases” tab and click on your database name. You’ll see a list of table names like this:
    WordPress Database Tables

    The two fields you need to edit are “siteurl” (highlighted above) and “home” (which you may need to navigate to the second page to find). Just click the “Edit” buttons next to each field, and replace the URL contained in “option_value” with “http://localhost/yourfoldername/”.’

    I don’t see either of these fields when I click back on the database tab and go to the database the only things that show are wp_ files such as links, options, postmeta etc.

    I’m soooooo close to achieving this but do you know what i’ve done wrong? I’d be so grateful for any pointers

    Thanks

    1. Gloria

      you need to navigate to the wp-options table to be able to edit those two values.

      1. Ian

        Thanks Gloria, that piece seems to be missing from the text. It looks like part of the piece might have been deleted.

        1. CK MacLeod

          Yes – the text refers to the “list of tables,” but actually shows an image of the “options” database itself when being browsed (the next step).

  54. Dave

    Hi there
    I followed the tutorial, and had the site running on my local PC perfectly. I tried to open the site a few days later and all i could get was a 404 error in IIS7. I found the solution for that and have Apache running on anther port and i can now open phpMyAdmin etc. However I can’t see my website on my PC or log into Wp admin. I just have a blank page.

    Any suggestions would be appreciated :-)

    Many thanks

  55. Zoe Hanis

    This tutorial was extremely helpful and well written. I just have 2 suggestions for additions since I had such a difficult time.
    1. Explain that the siteurl and home files are inside wp_options.
    2. Unless I missed it, nowhere in here do you have us reconfigure the wp-config file. I am not sure if it is mandatory, but I could not get anything other than a database connection error until I substituted in “root” and “localhost”.
    Thanks.

    1. Amrin Long

      Thank you. This is the step I was missing!

  56. Allan Collins

    Hi. I have downloaded my website (not a blog) to my local machine. It all works fine except for Flipping Book (not swearing!) Plugin. Can anybody give me a clue on how to get it to work. I wouldn’t mind having to create my Albums again if I could download Flipping Book to my Local machine. Tx allan

    1. Allan Collins

      Hi. OK – I have got it working. I downloaded the latest Flipping Book plugin onto my local machine and unzipped all the files to the xampp/htdocs/mysitename/wp-content/pageflip folder. The page flip albums have to be created again. I looked at the downloaded XML files from my site. They are just loaded with links back to the site that would never work on localhost once the site is bombed (which is going to happen in my case). allan

  57. Mike Lin

    (sorry for my poor english) My live wordpress site is installed in its own directory named “blog”, I set the homepage as a static page and the blogs on another page named “articles”, each given a navigation tab. After following your above guidance, the clone on my localhost run smooth except :
    1)All images still point to live website URL.
    2)When I clicked my “articles” navigation tab, it opens live web.
    3)On my live wordpress install, index.php file from “blog” directory was copied to root. Do I have to copy index.php to the WAMP’s root? (but inside WAMP root, there is already an index.php file. It seems a part of WAMP).
    4)My permalink is : category-postname-post_id, during setting up above process as per your guidance, when is the right timing to change the permalink to default and set it back to my preferred custom permalink?

    1. Mike Lin

      Oh… apparently, all the hyperlinks on my localhost install are also still pointing to the live website. What kind of wrong steps I did ?

      1. Jose

        Hi you need to replace the urls in your sql database with the local sites urls. Look into the wordpress codex on folder information on site migration.

  58. Stephen Liu

    Hi,

    I’m running LAMP on Debian 7.2.0 with WordProcess installed on /var/www/ phpmyadmin is also running on the local server.

    On browser /localhost
    IT WORKS

    I ran FileZilla copying the complete website /domain to /var/www/domain but could not make it to work. On browser /localhost/domain popup;
    File not found

    If changing localhost on /etc/hosts to domain then /localhost/domain popup;
    Error establishing a database connection

    I couldn’t resolve. Can you help? Thanks

    Furthermore I ran MySQL commands creating a new database in respect of user, password etc. according the info on /domain/wp-config.php but still I couldn’t make the download website work.

    /domain
    File not found

    /localhost/domain
    File not found

    Please help. Thanks in advance

    Rgds
    Stephen L

  59. Peter

    Thank you so much! You saved me!!!!

    1. Tom Ewer

      Great to hear Peter!

  60. Kim

    Hi Tom –

    I followed everything you said here, but my live site won’t duplicate onto the local server. I’m still being met with the initial WP theme/sample post no matter how many times I refresh. I’ve gone over this a bunch of times, gone back and done the steps again.. but it still won’t show up. Any thoughts?

    Thanks!

    1. Tom Ewer

      Hi Kim,

      I’m afraid without any details at all it’s impossible to know what the problem might be!

      Cheers,

      Tom

  61. Esme Dobson

    Just wanted to say thank you for the tutorial. Many hours and much frustration, but I’ve finally managed to make a local copy of a site, largely thanks to your tutorial.

    1. Tom Ewer

      No problem Esme :-)

  62. AnaViz

    Great post!

    But I had to change the urls inside wp-options to:
    http://localhost:8888/my-site-name/

    it would not work without the 8888

    Thanks!!

    Ana.

    1. Tom Ewer

      My pleasure Ana :-)

  63. John

    Brilliant! Many thanks, Tom, for such a clear and easy-to-follow tutorial. Gave me all the info I needed.

  64. nidhi

    the tutorial was too gud, i can run website on local in a single shot.thanks!

  65. komiska

    Hi! Thanks so much for this tutorial – very insightful!

    I hope you do still answer the questions ! –
    I get the “Unable to connect” error when trying to open any of the localhost URLs, whether it’s “localhost:8888/htdocs”, or only “localhost:8888/” .
    I have installed/ imported the WordPress install of a live site together with the DB and put everything into the htdocs folder directly , no “wordpress” folder inbetween.

    Followed everything you’ve written here:created a new DB , imported the one from the live site… all went smooth.
    I use MAMP.
    Changed the “wp-config.php” file , I have tried using “Sequel Pro” to connect to the database, and it does.
    I have changed the “siteurl” and “home” to “http://localhost:8888/htdocs” .
    MAMP is connected to Apache and MySQL.
    Everthing is in place, and i still get the damn error. Where did I fail?

    Thank you very much for the help!

    1. komiska

      It worked. I have learned from lovely Courtney Fantinato NOT to use the MAMP htdocs folder but a separated one. Set everything up again as you’ve written , and voilà – it magically worked, for whatever reason unknown to a noob like me.
      Any suggestions what it might have been?
      Apache was pointing to the MAMP htdocs folder, and it didn’t connect. Now it points to the designated local folder XY, and everything works.
      Sounds like some MAMP secret problem.

      Now i just have a small issue of the URLs not linking to the right places locally :)

  66. Sep

    Dear Tom Ewer,

    I downloaded a WP site with Httrack software. When I get to install database, I did not find wp-config.php file. So how can I get its database?

  67. Al Lemieux

    When I try to import the DB in phpMyAdmin, I get an error on the DB. It points to this line: `meta_id` bigint( 20 ) unsigned NOT NULL AUTO_INCREMENT , and says error #1046 – no database selected.

    What now?

    1. komiska

      Got that error when I just wanted to import a database: of course you have to first CREATE one with exactly the SAME name ( will save you trouble ahead :) ) THEN go to the Import tab…

      Also giving trouble was that creating a new user in phpMyAdmin was not enough: you really have to actively click on the GRANT checkbox when editing privileges.
      ( Well, this happened when using MAMP, maybe XAMPP is different) – Hope this comment helps others :)

  68. Saad Tariq

    When I import my site’s database to my local server and click go. I get the following error message:

    Error

    SQL query:


    — Database: `dstazcom_wp111`

    — ——————————————————–

    — Table structure for table `wp_bccf_dex_bccf_submissions`

    CREATE TABLE IF NOT EXISTS `wp_bccf_dex_bccf_submissions` (
    `id` mediumint( 9 ) NOT NULL AUTO_INCREMENT ,
    `calendar` int( 11 ) NOT NULL ,
    `time` datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00′,
    `booked_time_s` varchar( 250 ) NOT NULL DEFAULT ”,
    `booked_time_e` varchar( 250 ) NOT NULL DEFAULT ”,
    `booked_time_unformatted_s` varchar( 250 ) NOT NULL DEFAULT ”,
    `booked_time_unformatted_e` varchar( 250 ) NOT NULL DEFAULT ”,
    `name` varchar( 250 ) NOT NULL DEFAULT ”,
    `email` varchar( 250 ) NOT NULL DEFAULT ”,
    `phone` varchar( 250 ) NOT NULL DEFAULT ”,
    `notifyto` varchar( 250 ) NOT NULL DEFAULT ”,
    `question` text,
    `buffered_date` text,
    UNIQUE KEY `id` ( `id` )
    ) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =1;

    MySQL said: Documentation
    #1046 – No database selected

    What might be the cause of this. Can anyone hep me

  69. Cassandra Howell

    Thanks for this tutorial. I was following it with great enthusiasm until I arrived at the step where I entered: http://localhost/ and just got an ‘unable to connect’ repeatedly.

    Now I’m pulling my hair out! Any suggestions?

    The other step that stumped me was the very last one, as I can’t find ‘siteurl’ or ‘home’ even in the wp-options table!
    Any help would be greatly appreciated for this newbie!

    Thanks
    Cass

    1. Sten

      Try listing the ‘wp_options’ table by alphabetical order (just click option_name in phpmyadmin); it should make ‘siteurl’ and ‘home’ easier to find.

  70. Brooke

    Hi Tom,

    Great tutorial for someone like me who has no clue what they are doing :) I have a question – I’m in step two and I transferred the root file in filezilla as described. However when I do the test you mention of going to http://localhost/foldername/ I do not get an error…there is still an index there of files. I checked my Xammp/htdocs folder and all the files are there. Should I proceed to step 3 or did I do something wrong?

    Thank you!

    1. Tom Ewer

      Hey Brooke,

      If you’re not getting an error then I’d carry on and see what happens…

      Cheers,

      Tom

  71. sara

    i did all what you said and it is working but now i can open my live website when i try to open wp-adim it give me a blank page and i found that the host became local host how i can get it back

    1. Tom Ewer

      Hi Sara,

      Your best bet is to contact ManageWP support directly with your issue — I’m sure they’ll be able to sort it out.

      Cheers,

      Tom

  72. Rama

    You may find it better to use LAMP instead. Most WP sites are on LAMP servers (and there are differences).

    For those who are still Windows users, a more stable approach would be to have a separate box with LAMP on it, which also keeps your Windows box safe in the event that something happens. 😉

  73. alanbu

    Thanks Michael Vila!

    Getting there (I think!). Can create a new web site and phpMyAdmin says I have successfully ipmorted my live database into a newly created database.

    I have created the user & password using the data from the config file.

    The database name in config is used as the database name in phpMyAdmin, and as the folder name in htdocs.

    The home & siteurl are set to http://localhost/db410283526/ again reflecting the database name

    However, I am now stuck at the last hurdle – whatever I try, I get:

    The website cannot display the page

    HTTP 500

    Most likely causes:
    •The website is under maintenance.
    •The website has a programming error

    Help!!!

    1. alanbu

      Sorted!!

      – I had picked up the earlier comment that the URL changes were in wp options.

      The bit I was missing it that in the wp congig.php file, the hostname needs to be changed to LOCALHOST from the setting imported from the live site.

      Thanks again for the help.

  74. alanbu

    Really useful, thanks – As a complete beginner, I found this really easy to follow. I have only one problem, and I hope someone can help. When I try to import the database into myphpadmin on my pc, I get the error message shown below. I have tried to download the db fromthe website a number of different ways – the resultant file always seems very small (ABout 3Mb) if it is supposed to contain pictures &c from the site. Any idea what i am doing wrong?

    Error

    SQL query:

    — phpMyAdmin SQL Dump
    — version 2.6.4-pl3
    http://www.phpmyadmin.net

    — Host: db410283526.db.1and1.com
    — Generation Time: Mar 29, 2013 at 11:51 AM
    — Server version: 5.1.67
    — PHP Version: 5.3.3-7+squeeze15

    — Database: `db410283526`

    — ——————————————————–

    — Table structure for table `wp_commentmeta`

    DROPTABLEIFEXISTS`wp_commentmeta` ;

    MySQL said:
    #1046 – No database selected

    1. Michael Vila

      Yes alanbu, First, be careful that you select the correct database before you export. If you export without selecting a database, you will not get the same result. Second, make sure you CREATE a database in phpMyAdmin BEFORE you try to import. And make sure you select it after creating it. Then you must make sure the correct database name is inserted in the wp-config.

      Hope this helps,

      Mike

  75. Michael Vila

    Excellent instructions, easy to follow and the images are great! Worked perfectly. FYI, siteurl and home are both under the wp_options table. And please, if you change the permalinks, DO NOT FORGET to change them back or you will break previous Google indexeing.

    Thanks again!

    Mike

  76. Felicia

    I keep getting “Server Error The website encountered an error while retrieving http://localhost:8888/essencia/. It may be down for maintenance or configured incorrectly.”

    I’ve also tried http://localhost:8888/foldername still giving me the same “Server Error” prompt.

    Everything has worked fine for me up until this point.

    1. Felicia

      Should I make a local copy of just my “public_html” folder or should I create a copy of everything from “.bash_logout” to “xmlrpx.php”?

  77. Dynasites

    I went through the first tutorial with no problems. I then installed Socrates Theme v3.04 and began getting errors. Couldn’t even login to admin.

    Through Explorer, I just deleted the Socrates theme folder and everything worked fine. Forum support said…
    “Usually it has a different error message than that but one problem people have seen with Wamp installations is the cURL php library not being installed/activated.”

    This is way beyond my expertise, but I will refer to that post here in case some one has run into this challenge before and has an easy answer.

    Other wise, I really appreciate these articles, and the ManageWP Blog. As a ManageWP customer, your resources have helped and educated me faster than anything else!

  78. Glenn Tate

    One problem is with the serialized data. Options especially Theme options are stored this way and will break when the url is changed without changing the string length. Luckily there is this tool.

    http://interconnectit.com/124/search-and-replace-for-wordpress-databases/

  79. Colin Crawford

    I went the other way Local to Live and as littleguy said your images and other links have to be changed as well or otherwise they don’t work or you can’t view the images. Good job I didn’t have that many and made the changes within the pages and posts.

    The images were pointing to local host. There is a utility here Search and replace for WordPress databases/, I’ve not used it yet but it might be useful.

    1. kam @ TheGeekScope

      Colin, I agree with you..

      Changing of all the links in your website can be achieved very easily with the help of a plugin “Velvet Blues Update URLs”

      For detailed information please visit.

      http://www.thegeekscope.com/how-to-copy-a-live-wordpress-website-to-local-windows-environment/

  80. littleguy

    Except all the links to pages and images are defaulted to absolute URIs when you add them, so none of your links or images will work. This is a huge problem with WordPress, not the tutorial.

    1. jw

      You can use output buffering to deal with the absolute URIs

      ob_start(‘my_callback’);

      function my_callback($out) {
      return str_replace( ‘live.example.com’, ‘stage.example.com’, $out );
      }

      As suggested by Otto on wp-hackers: http://lists.automattic.com/pipermail/wp-hackers/2010-December/036875.html

      1. Tom Ewer

        Guys,

        Not sure I understand the problem here – I don’t have any issues with links or images by following this method.

        However, whatever the problem is, it would appear that JW has provided a solution 😉

        Cheers,

        Tom

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>