Already a customer? Please sign in.

Convert a local WordPress XAMPP installation into a live site

by Drew Strojny on July 17, 2007 / 18 comments

I recently found this quick and easy tutorial on installing XAMPP Lite locally on Windows XP. This provides a great environment for testing and developing WordPress websites from your PC. The next logical step is converting this nice local installation into a live site as quickly and easily as possible. I found some excellent instructions from The Tamba2 WordPress Guides. These guides contain almost all the information used in this tutorial. I really just combined a bunch of the provided information to accomplish this specific task. I put all the instructions together here in a quick, and (hopefully) easy to follow tutorial. Let’s get started.

Export Your Database

First, we need to export your local XAMPP MySQL database. While XAMPP is running, navigate to http://localhost/phpMyAdmin/. Next, click on the database name you want to export in the menu on the left. Your database tables should be displayed and you should see some tabs running across the top. Click the export tab at the top.

Make sure you check the “save as file” box and then click the go button in the lower right. This will create an .sql file for us to import later. Remember where it is saved.

The Import

  1. Log in to your hosting account or your webserver and create a new MySQL database for WordPress, call it whatever you want.
  2. Once you have created your new database, find PHPMyAdmin, and open it.
  3. Click the name of the database you just created from the dropdown menu.
  4. At the top of the screen it should say “Server: your_server(probably localhost) Database: your_database_name”
  5. Click the Import Tab.
  6. Now click the Browse Button and browse to the location where you saved your *.sql file in the first part of the tutorial.
  7. Click Go at the bottom.
  8. You should get a message at the top stating: “Import has been successfully finished, XXX queries executed.”
Important: If you are importing an extremely large database, over 5MB, you may suffer from a timeout and failed import. If this is the case you need to manually upload your data in parts. See Podz detailed instructions for restoring if you are having this problem.

A couple quick changes

Now we need to make a couple quick changes to the database. Click on the Structure tab at the top and then click the little picture in the wp-options row as seen below.

You should now see a list with a column showing all of the option_name values: siteurl, blogname, blogdescription, etc. You need to change two of them. The first is the very first option, siteurl. Click the little pen button on the left side of the siteurl table row. It is directly to the left of the big red X. You should now see something similar to this:

Type your new blog URL in the big text box. Important: Make sure you do not add a forward slash / at the end of the URL.

Click Go.

Your siteurl row should now display your new blog URL instead of localhost or whatever IP address it was showing before.

Now you must repeat this same exact operation on a different option row with the option_name of home. You may have to use the pagination to view the second page of option rows to find it. It is option_id #39 on a normal WordPress install.

Your new database is now ready to go, exit PHPMyAdmin.

Edit, Upload, and Go!

Browse to your local WordPress installation.

Open up your wp-config.php file and input the MySQL details (username, password, etc.) of the new database you created in the previous step.

Save and close wp-config.php.

Upload the ENTIRE contents of your local WordPress folder to the new location on your webserver. This new location should must be the same one you used in the first part of this tutorial when changing the siteurl and home values in phpMyAdmin. This is important. If the locations are different, it will not work.

Your done, navigate to your new “live” WordPress powered website and enjoy.

Note: If you want to continue using your local installation you can keep your updated wp_config.php file and add the following lines of code to your local version of the file(this will override the two option values we changed earlier in phpMyAdmin):
//*Set Path
define('WP_HOME', 'http://localhost' );
define('WP_SITEURL', 'http://localhost');

Enjoy this post? Read more like it in Tutorials.

18 Comments

  1. Focado

    Smart tutorial, beautiful design, I wanna thank you for making so simple the upload of a wordpress local installation to a live website. You deserve all the keywords, man :)

    I have 2 questions:

    1. May I translate this tutorial to portuguese and make it available at my website?

    2. I have been searching for a syntax highlighting plug in and it seems to me you have found it, could you tell me where?

  2. Drew Strojny

    Focado: Thanks, feel free to translate the tutorial to Portugese, as long as you leave a link back here I don’t mind at all. I am not using a syntax highlighting plug in.

  3. dreedenator

    SOS…I can’t find the .sql file?! I’ve come this far, and can’t figure out why my content I built locally won’t show up live 0.0 !

    I followed this tutorial but there is no sql file no matter where I look!

  4. Drew Strojny

    dreedenator: When you use the backup plugin it creates a Gzip file, which is similar to a zip file. You need to decompress this Gzip file to find the .sql file.

  5. Antheor

    I tried to follow the instructions but I’m stuck here :
    After opening phpmydamin, clciking on my database, I can’t see server info and there is no ‘import’ tab (only export and others)

  6. Flo

    Thanks so much for posting this. I know you saved me hours(days?)figuring this out on my own.

  7. Skeezix

    Great tut! Bookmarked it for later use!

    My problem is the inverse – I want to populate my local installation of WP (through XAMPP) with the online backup but because it contains URIs to the online file, I’m not sure what to do.

    I can do a Find/Replace easy enough on the .sql file to replace http://mysite with http://localhost, but what other files in the local setup must be changed?? I revised my wp-config.php file but either did it wrong or forgot to do something else.

    Anyway, I appreciate your time and efforts with your procedure. Maybe if you have a tip for the reverse, you could pass it on to me??

  8. ross

    Thanks a lot for this simple tutorial, haven’t tried it out yet, but if it works it should save me a huge headache.

    Keep up the good work.

  9. Nathaniel

    Thanks you so much for this tutorial! I followed it and it guided me successfully to start my second site.

  10. Frank

    Local vs. Live issues in wp-config.php can be resolved easier:
    Have the script decide if you’re on localhost:

    if ( (0 == strncmp(‘localhost:’, $_SERVER['HTTP_HOST'], 10)) )
    {
    // local
    define(‘DB_NAME’, ‘something’);
    define(‘DB_USER’, ‘here’);
    define(‘DB_PASSWORD’, ‘here’);
    }
    else
    { // live
    define(‘DB_NAME’, ‘something else here’);
    define(‘DB_USER’, ‘here’);
    define(‘DB_PASSWORD’, ‘here’);
    }

    (must access by localhost:// then, not 127.0.0.1 naturally)

  11. Mike

    Hey, just wanted to say thanks for this. I found a link to this on a Yahoo question, and the poster said it was a bit “too complicated” but it was a breeze. Didn’t run into any trouble and it worked exactly as described.

  12. joomlafan

    OMG. This is a great tutorial. Hats off to the master. You saved my day! Thanks a million!:)

  13. aar

    Wow… it’s a simple but wonderful tutorial. It’s a nice experience to see my first WordPress installation problem being solved. Your tutorial works! Thanks a bunch for the tutorial. ^_^

  14. Ted

    A couple of easy steps and local wordpress installation goes live! Thanks for the tutorial Drew.

  15. Alan Houser

    Whoops. Everything works, however, the problem I’m having is — every asset on my local server is referenced as ‘localhost’. All assets are showing-up correctly, only because I have the same local server running {Hilarious, actually}.

    I changed the two option_name values of ‘siteurl’ and ‘home’ to the correct remote url.

    I’m assuming EVRYTHING in my database is referencing localhost. Is there a way to fix this?

    Thanks!

Comments are closed.