How to Create a Local Copy of a Live WordPress Site

Update: This is an old article (from 2012), and as such it may contain information that is now obsolete.

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:


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:


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.


Creative Commons image courtesy of e³°°°

Tom Ewer

Tom Ewer is the founder of 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!


  1. Bobby J

    Works like a charm for Synology NAS too. Just once you install the WordPress on the NAS remove all the files and folders and upload the ones that you downloaded from your original installation.
    Thanks mate !!!

  2. Christian Panratz

    Hey Tom,
    just wanted to say thank you for the great article, it helped me a lot

  3. Akash Gupta

    I am using port 81 for Apache when I surff for localhost:81/myfoldername , browser automatically redirects me to localhost/myfoldername on which my Apache is not running how to overcome this problem.. all other sites working fine on port 81.

  4. Chaprel

    I’ve followed the steps and my site goes local but the problem is it is only the index page and when i go to the other pages the local server wont recognize it.

    1. alvaro hernandez

      x2 and the css seems diferent

  5. Bernard

    I think I have followed all the instructions above and I have used’s Search and Replace tool to change all the urls. However when I try to access my local website I get an error message. My online website uses HTTPS, so I have tried both http and https to access it locally. Using http I get “Error Establishing a Database Connection” and using HTTPS I get “Hmmm…can’t reach this page” and a further error code of “INET_E_RESOURCE_NOT_FOUND”, both using Google Chrome. I have tried specifying Require SSL and Require None when defining the privileges for the database user but this doesn’t seem to change anything. Any ideas on what I’m doing wrong please?

    1. T

      I changed the MySQL hostname to localhost and managed to get past the error –

      /** MySQL hostname */
      define(‘DB_HOST’, ‘localhost’);

  6. Terry Eelekes

    I am using MAMP on my local server and all went well so far but when I try to login to the dashboard the page just stalls. any suggestion on what the problem is?

  7. marisk

    Followed these instructions and downloaded the site from GoDaddy Managed wordpress to local xampp. Looks like most of it works – it renders correctly – but all my menus and page links redirect to my local xampp dashboard.

    Any thoughts ?

    1. Nemanja Aleksic

      Do you meant that the online website redirects to XAMPP?

      1. marisk

        The local xampp site redirects to the local xampp dashboard. I.e., when the home page comes up the address barr shows the localhost address – localhost:{port#}/wp. Clicking on a menu item redirects to localhost/dashboard which is the xampp welcome page. I did note that the Home menu is a custom url that points to the GoDaddy site and if I susequently click the home link I get redirected to the online site and all the menus work. But at that point I’m on the ‘live’ site and not on my local dev site.

        1. Michael

          I am experiencing this same issue. Every link on my local site takes me to the XAMP dashboard.

        2. Reuben

          Go to Settings/Permalinks in the WordPress dashboard and update permalinks by clicking twice on save changes. That’s all. This worked for me

          1. Renee

            Thanks – this worked for me too – I had overlooked changing the permalinks to default/plain. I also had to change the ‘localhost’ parts (in the 2 locations -home+siteurl- in phpMyAdmin and in the wp-config.php file to my IP address.

  8. wallace

    thank you for such a concise and helpful tutorial!

  9. Jan Marie

    I followed this to a T, and now we’re at the end, many many hours later, and there is nothing but a blank WP site live on my localhost/mynewsite. I’m not clear how or if I was supposed to get all my files that I exported via http://FTP... into the new site. Was I supposed to put the files into htdocs/mynewsite? Because they’re currently all hosted at htdocs/myoldsite, though I did replace the database as directed in step 5…

  10. kaidok

    I’ve tried and tried and tried. I’ve spent the past 3 hours stuck at the point where you import the database. Every single time I get the error that it’s too large. I have no clue how to get into the mySQLadmin (I see MySQL but no admin area) I’ve tried adjusted the limits in the ini file… NOTHING I do seems to make this work. Someone on here suggested using the “other” work arounds that are alluded to in the documentation, but I have no clue how to go about doing either of those other options as I see no other console to log into. Please please help!

    1. Hockenhauser

      A bit late … but I had that problem – It turned out the database had exported as an uncompressed .sql – I zipped it up so it became then tried importing it and it worked?

  11. tech journalists

    Loving the information on this web site, you have done great job on the posts.

  12. Isaac Peterson

    ok maybe I’m not understanding this correctly
    when rename the URL http://localhost/your_folder_name
    what is the folder name? is it arbitrary?

  13. John

    The guide leaves out a few important things:

    1: If the database won’t upload because it is too large, you need to go into Xampp Control Panel, under Apache>config button>php.ini. From here search for “upload_max_filesize” and change to something like upload_max_filesize=16M. Next, do the same for “upload_max_filesize” to something like upload_max_filesize=16M (just has to not be smaller than db size).

    2. In order to import the database you have to create a new database entry to then be able to import your database into. In phpmyadmin sidebar add a new database with same name as the database you are importing. Once you’ve done that, import your database into it.

  14. Seth

    Is it possible to use wordpress as a local intranet only? I’ve installed it on wamp locally and can add pages but cannot edit any page content. Is this possible using the local wordpress install or is it just viewable locally and not editable?

  15. Villiam

    Hi, thanks for the steps – which I followed. But its not working. When I type “localhost/The folders name”, I come to the site and it looks almost the same as the live one except for some buttons on the front page. But I can’t log in to the dash board, and when I click on some of the other options on my sites menu it just goes to the live version.
    You know where I went wrong?

    1. shailesh

      Mine too, hope we have a solution.

    2. Stan

      Hi Villiam,

      Try this tool and replace all instances of to localhost/your-folder-name.

      I’m not really sure what the problem with your login might be, though :/ Try first with the tool I suggested and let’s see how it goes from there 🙂

    3. Cakelab

      Hey, I know it’s an old post, but I too got the same error. To fix it, I deleted the wp-config file in my backed-up website folder. Then when I typed the “localhost/yourfoldername” it took me to a “new” wordpress installation that led me eventually to my local copy. I hope this helps anyone stuck on the same issue.

  16. san

    I was wonder, where could I find XAMP for 64bit, and why the official website has not any download ability ?

  17. Atanas

    Works perfectly!!!

  18. 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.

  19. 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”?

    1. Stan

      Just select all of the tables, it’s the same as selecting the database.

  20. Saud Khan

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

    1. Nemanja Aleksic

      Hi Saud, your One Drive picture is not publicly accessible 🙂

  21. 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.

  22. elaine

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

  23. 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

  24. Adarsh

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

  25. anno1313

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

  26. WJC

    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/\ 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.

  27. 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!

  28. El Sombrero

    Didn’t work for me either…

  29. 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…?


  30. 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:

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

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

    1. Renee

      This worked for me – thanks for the suggestion.

  31. 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!

  32. 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

  33. 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

  34. 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.

  35. Mahesh Yadav


    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.

  36. 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.

  37. 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!


    1. Greg

      Having the same exact problem. Hopefully an answer soon.

      1. Al

        change internal link names to local address. refer here

  38. 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'”


    1. Rob

      … I meant ‘wp_options’.

      1. Nemanja Aleksic

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

  39. 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!

  40. Adam

    If your life changes, we can change the world, too.

  41. Yole Ajekigbe

    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.

  42. 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!

  43. Siya

    Thank you! This saved me a lot of time

  44. 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?

  45. 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 ‘’ 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!


  46. bsarioz

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

  47. 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.

  48. 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

  49. 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?

  50. 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.

  51. 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

  52. Emerfan

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

  53. Aaron


    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?


    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 so that we can investigate thoroughly. Thanks!

      Davor Altman

  54. 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, we can continue the communication there and resolve this issue together 🙂 I will be awaiting to hear from you. Thanks!

  55. Alejandro Gutierrez


    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.


  56. Sandeep

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

  57. 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!

  58. 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.

  59. 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.

  60. 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.

  61. 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:

    1. Tom Ewer


      Thanks for the tip!

  62. 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! 🙂

  63. 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?


  64. 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!

  65. 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?



    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?

  66. 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…



  67. 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.

  68. Annukka

    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!

  69. steve


    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


    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).

  70. 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

  71. 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”.

    1. Amrin Long

      Thank you. This is the step I was missing!

  72. 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

  73. 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.

  74. Stephen Liu


    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

    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.

    File not found

    File not found

    Please help. Thanks in advance

    Stephen L

  75. Peter

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

    1. Tom Ewer


      Great to hear Peter!

  76. 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?


    1. Tom Ewer


      Hi Kim,

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



  77. 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 🙂

  78. AnaViz

    Great post!

    But I had to change the urls inside wp-options to:

    it would not work without the 8888



    1. Tom Ewer


      My pleasure Ana 🙂

  79. John

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

  80. nidhi

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

  81. 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 🙂

  82. 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?

  83. 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 🙂

      1. John

        Wow, three years later and still hasn’t fixed.

      2. Braden

        Thank you! This is what I wanted to know. I was thinking it would be able to create a new database by itself through the import process. Created database, all is well. 🙂

  84. Saad Tariq

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


    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` )

    MySQL said: Documentation
    #1046 – No database selected

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

  85. 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!


    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.

  86. 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…



  87. 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.



  88. 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. 😉

  89. 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


    1. alanbu


      – 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.

  90. 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?


    SQL query:

    — phpMyAdmin SQL Dump
    — version 2.6.4-pl3

    — Host:
    — 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,


  91. 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!


  92. 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”?

  93. 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!

  94. 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.

  95. 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.

  96. 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


      function my_callback($out) {
      return str_replace( ‘’, ‘’, $out );

      As suggested by Otto on wp-hackers:

      1. Tom Ewer



        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 😉



        1. David J Brossard

          I think the problem is that a wordpress export will also contain the host name configuration. Things like URLs and the login page use that parameter. I had to either update the parameter inside the DB via a DB tool or set these 2 lines in wp-config.ini

          define( ‘WP_SITEURL’, ‘http://xxxxx’);
          define( ‘WP_HOME’, ‘http://xxxxx);

Leave a Reply

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

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!

Have questions? Get in touch!

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!

Have questions? Get in touch!

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!

Have questions? Get in touch!

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!

Have questions? Get in touch!