In the last two chapters, I talked about Installing WordPress Locally and Building Custom WordPress Theme. This chapter will cover exporting your local WordPress to a web host. Assume you are done with the local WordPress development, it is time to learn how to export and import WordPress. Then you can keep the local version for backup purpose and future development (ie. testing new themes, plugins, and upgrades).

1. Export Local Database

Login to your local phpMyAdmin, select the database from the dropdown. Click on the Export tab:

  • Under the Export field, make sure all tables are selected
  • Under the Structure field, tick "Add DROP TABLE / DROP VIEW"
  • Tick "Save as File"
  • Then click Go and it will prompt you to download a SQL file

export database

2. Find & Replace All Local URLs

Open the database SQL file with a text editor. Find and replace all local URLs with your domain URL (eg. replace all "http://localhost:8888/mysite" with "http://www.yourdomain.com").

export database

3. Import The Database

Login to your server cPanel, go to MySQL Databases, create a new database and assign a user. Now go to phpMyAdmin, select the database (the one that was just created) from the dropdown, click on the Import tab, browse the SQL file and click Go.

export database

4. Upload WordPress

Upload the entire WordPress folder to your server.

5. Change The wp-config.php Setting

On your server, open the wp-config.php file. Change the database details to reflect your server settings.

export database

6. Done

Go to your website and everything should work perfect.

262 Comments

1 11 12 13
  1. Nelly Naneva
    Apr 22, 2012 @ 4:14 am

    Thanks for the easy to undersand report. You have answered all my questions and save me a lot of time wondering what to do.

    I have one more question: if you move from one hosting (Godaddy) to another, how to preserve the mailbox e-mails and move them later on to the new mailbox with the same name?

    Reply

  2. bitkisel
    May 2, 2012 @ 1:21 pm

    Thanks for the easy to undersand report. You have answered all my questions and save me a lot of time wondering what to do.

    I have one more question: if you move from one hosting (Godaddy) to another, how to preserve the mailbox e-mails and move them later on to the new mailbox with the same name?

    Reply

  3. chris
    May 5, 2012 @ 11:23 pm

    hey thanks for this :) made a development site switch a lot easier!

    Reply

  4. birgitte
    Aug 28, 2012 @ 3:38 am

    Thank you so much for this easy tutorial, and for sharing your knowledge, it saved me.
    I’m a first time MAMP user (and first time WP user) and this made getting my site live, not quite a breeze, but definitely do-able.

    Reply

  5. yum
    Aug 31, 2012 @ 11:31 pm

    i just want to ask… on step 4, “Upload the entire WordPress folder to your server” how do you upload the whole WordPress folder through phpmyadmin? Need help on that…
    Anyway,
    Thank you!

    Reply

    • Jorge Psendziuk
      Nov 14, 2012 @ 5:03 pm

      Not through phpadmin, but via your FTP client, or file upload on your server’s control panel. :)

      Reply

  6. Alquiler yates Ibiza
    Sep 1, 2012 @ 4:17 am

    Upload the entire WordPress folder to your server” how do you upload the whole WordPress folder through phpmyadmin? Need help on that…

    Reply

    • Jorge Psendziuk
      Nov 14, 2012 @ 5:02 pm

      Not through phpadmin, but via your FTP client, or file upload on your server’s control panel.

      Reply

  7. Rebecca
    Sep 15, 2012 @ 11:47 am

    i have followed these instrucitons (skipped the custom template since i am using a purchased templagte) but my phpMyAdmin screens look different than yours and i can’t follow them since things are not the same. for example:

    OK -Under the Export field, make sure all tables are selected
    NO – THIS IS UNDER THE OPERATIONS TAB- Under the Structure field, tick “Add DROP TABLE / DROP VIEW”
    NO DROP TAB, its under the export tab and then i have to toggle the custom field Tick “Save as File”
    Then click Go and it will prompt you to download a SQL file

    ok…then i go to the next set of instructions and import the data base and of course it shows me ERROR…can’t go any further. i have done this 500 x…..
    can you help me?

    MAMP version 2.1.1
    Mac OSX 10.6.8

    Reply

  8. Rebecca
    Sep 15, 2012 @ 11:59 am

    this is the error:
    Error

    SQL query:

    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

    /*!40101 SET NAMES utf8 */;


    — Database: `ftcWP_0915`

    CREATE DATABASE `ftcWP_0915` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

    MySQL said: Documentation
    #1044 – Access denied for user ‘rburns’@’10.%’ to database ‘ftcWP_0915’

    Reply

  9. sasha raskin
    Oct 27, 2012 @ 9:26 am

    Thank you so much! This is the best manual on the net. Much better than worpdpress’ manual itself and better than my hosting company’s site, and that’s supposed to be their job. I use this manual with any new site i build, juts to make sure i do everything right.

    For those asking how to transfer the files, best option is the use the free ftp software FileZilla. It’s all drag and drop and never does any problems in copying files from your computer to the storage server. The configuration details you can get from your tech support of the storage site.

    Thnx again!
    sasha

    Reply

  10. uma
    Dec 4, 2012 @ 11:26 pm

    how to extract wordpress file in html.not xml please solve my problem….

    Reply

  11. Abhi
    May 29, 2013 @ 7:07 am

    Lots of Confusion as a Newbie But this time Got An Idea
    Thanks Admin

    Reply

  12. shan dmello
    Nov 21, 2016 @ 1:49 pm

    I think you need to amend all your tutorial for the latest version of the WP and lot more changes are arrived to be updated.
    else the content available on your site confuses with what is latest installed.

    please note to update to up to date,

    Reply

    • Vail Joy
      Nov 22, 2016 @ 11:18 am

      Hi Shan!

      The date on this article is your best indicator that it probably doesn’t apply to the latest WordPress anymore. As time goes on, more updated articles will be added or Nick will revisit older ones to update them as he can. Cheers!

      Reply

1 11 12 13

Leave a Reply