How to Install a Local WordPress Blog and Transfer it in Web Server

Written by Amit Banerjee on 14 Dec, 2009 Under Blogging

You can install a local WordPress blog in your computer for various testing purposes. Using the local blog you can create new themes, plugins and perform other experiments. Here is a detailed guide on how to transfer the local WordPress blog in your web server with the same preferences, posts, plugins and themes.

Preeti asked:

I have a local WordPress blog in my computer made using Wamp. I want to transfer this blog in my web sever, with all the posts, pages, plugins, themes etc. What are the steps involved for the entire process.

Installing a Local WordPress Blog in your Computer with Wamp

Here is a step by step guide to install a WordPress blog in your system which you can use without requiring an internet connection. You can use this tutorial to install a WordPress blog in Windows XP, Vista and Windows 7.

1. Download the latest version of WordPress.

2. Download Wamp and install the application. During installation, Windows firewall will throw a message like this

installing-wamp-windows

Choose “unblock” and continue to finish the installation process.

3. Go to the directory of your wamp installation. Typically it would be present in the C drive as C > wamp.

4. Open the folder “www” and create a folder named test (the folder can be named anything but for the sake of this tutorial we will stick to the name “test”).

5. Extract all the files from the WordPress package in to this folder. So that means, all the core WordPress files will be present in “C:\wamp\www\test”

offline-wordpress-installation

Thus the url of your Local blog becomes : http://localhost/test

6. Start the Wamp server program and select “Start all services” from the system tray icon.

start-wamp-engine

7.  Open your web browser and navigate to http://localhost/phpmyadmin. You will see something similar as shown below:

phpmyadmin-window-wamp

8. Now you are going to create a database for the local WordPress blog in your computer. In the “Create a new database” field type a name for the database of your blog. (e.g testblog)

create-local-database-phypmyadmin-wamp

9. Go to the installation directory of your local WordPress blog ( C >wamp >www > test), right click the wp-config-sample.php file and rename it to wp-config.php.

10. Open the wp-config.php file with notepad or any Html editor and enter the following details:

DB_NAME : testblog (name of the database)

DB_USER: root

DB_PASSWORD: (keep it blank)

DB_HOST: localhost

Here is the screenshot of the database details

wordpress-database-details-wamp

11. Now open http://localhost/sqlitemanager/ in your browser.

12. Enter the database name you created in phpmyadmin (in this case it’s “testblog”).

13. Click the Browse button and navigate to the following path

C >wamp > bin> mysql > data >testblog

You will find a “db.opt” file in that folder. Select the file and the checkbox “upload database”. Hit save when you are done.

wamp-sqlite-manager-wordpress

14. Open your browser and browse to the address of your local blog (in this case http://localhost/test).

15. Bingo ! You will see the WordPress installation screen. Give a Blog title and enter any email address and hit “Install WordPress”.

install-wordpress-locally-wamp

WordPress will be installed and you will be given a username and password to login to your  dashboard.

Note: If you do not see the Installation page, probably you missed out something. It’s better to restart the process from scratch.

Configuring the Local WordPress Blog

Now that the Installation part is over, you can start customizing your local blog. At first, login to your local blog and change the password to something you can remember. You can install all the plugins, themes, write posts, pages and do the necessary customizations in your local WordPress blog. After you are satisfied with all the customizations, it’s time to move the blog in your web server.

How to Move the Local WordPress blog in your Web server

Let us suppose you want to transfer the local WordPress blog in your computer (http://localhost/test) into your web server at www.yoursite.com/blog. While you can do it at your root directory as well, for the sake of this tutorial, we have chosen http://www.yoursite.com/blog as the web address.

Before you read on, here are a few points to take note of

Scenario A: You already have an installed WordPress blog in your web server. You just want to transfer the local blog in the same installation directory ( e.g http://localhost/test > http://www.yoursite.com/blog).

Scenario B: You do not have an online WordPress blog. You want to transfer the local blog in to a newly created online blog.

Following are the steps involved to perform the migration of your local WordPress blog to your Web hosting account:

1. At first, disable all the plugins in your local WordPress blog.

2. Backing up the database of your Local blog: Next, you need to back up the database of your local WordPress blog. You can use a database back up plugin to back up the database of your local blog or you can back up the database from phpmyadmin as well.

To back up the database from phpmyadmin, open http://localhost/phpmyadmin in your browser and select the database of your local blog (in this case “testblog”).

select-database-phpmyadmin

Navigate to the “Export” tab, keep everything untouched, scroll down and select the checkbox “Save as file”. Then click “Go” and you will be prompted to save the database in Sql format.

back-up-sql-database-phpmyadmin

3. Very important: Open the database backup file (testblog.sql) in notepad. We have to replace the URL of the blog with the newer url of your blog where you will be mounting the database.

For example : If your local blog’s url is http://localhost/test/ and your web blog url is http://www.yoursite.com/blog then you will have to replace every url (http://localhost/test/ with http://www.yoursite.com/blog in the database).

replace-url's-database

Once you open the database file in notepad, search for your local blog’s base url ( in this case it’s http://localhost/test). Replace the Url with the root address of your Web blog. (http://www.yoursite.com/blog). Use Ctrl + F to find the local blog’s base URL in notepad and then paste the web blog’s base URL. Next, hit “Replace all” and you are done.

4. Now it’s time to upload all the core WordPress files, themes, plugins etc. Open your FTP program and upload all the files of your local WordPress blog in to your web server

upload-wordpress-files-local-blog-web-server

If you already have all the WordPress files uploaded in your web server then no need to upload them again. Just delete the “Wp-content” folder and upload the “Wp-content” folder of your local blog in the respective directory.

It would be better to do a fresh migration and hence it is recomended to delete all the old files and start afresh.

For example : If you want to install WordPress at your web server at http://www.yoursite.com/blog then first delete all the files and then upload all the files from C:\wamp\test in that web directory

5. Once the upload is complete, login to the C panel of your web hosting account. We will create a new database and import the database of the local WordPress blog here.

Create a new database in your web hosting account, using the database wizard. Create a new database user and give all the privileges to the user you just created.

database-wizard-phpmyadmin

5. Open your FTP software and browse to the directory where you have uploaded your WordPress files.

6. Download the wp-config.php file in your computer and open it in notepad for editing

7. The wp-config.php file will still contain the database information of the local blog. You will need to update it with the database information you created in step 2.

Here is how the wp-config.php file looks

database-config-wordpress

8. After updating the wp-config.php file, upload it back at your web server’s WordPress installation directory. ( i.e http://www.yoursite.com/blog)

9. Now browse to the root of your blog. You will see the installation screen of WordPress.

wordpress-install-screen

10. Do not install WordPress from here on. We will mount the database of your local blog in to this database.

11. Open the C panel of your Web hosting account and navigate to PHPMYADMIN.

12. Select the database you created in step 3 from the left pane and click the import tab

phpmyadmin-import-database

13. Click the browse button and upload the database backup of your local blog that you backed up in step 3. Hit “Go “ when done.

14. Hopefully, importing of the database will be successful.

import-database-into-existing-database

15. Browse to the root of your Web blog. You will see the exact copy of your Local blog in your web server.

Do let us know whether you were able to transfer the local blog in your web server or not through a comment

  1. Reader Comments

  2. Wonderful tutorial as always. I’m saving this one to my scrapbook for future reference. Thanks

    December 15th, 2009
    • @Udegbunam Chukwudi Nice to hear that man.

      December 15th, 2009
  3. An amazing article, just worked out for me.

    February 6th, 2010
    • Thanks Altaf for your appreciation.

      February 9th, 2010
  4. That is a really nice detailed guide, thanks. Being able to modify your site in a test environment is essential if you are going to develop and change themes, and don’t want your visitors to see your site as broken when you are in the middle of tests.

    March 5th, 2010
    • Thanks again Tony for all those comments. For all those bloggers who are new to WordPress, I highly recommend Wamp, because it gives you a testing place to know and learn about WordPress, do custom theme mock ups and test plugins.

      March 5th, 2010
  5. This is a very great guide. I would consider bookmarking it as it is exactly what I was looking for. Now I just got my demo site online and can show it to my client via my remote server online. Thank you!

    March 26th, 2010
    • @Enjon: Glad you liked it. Yes, this guide is exactly for the purpose which you have stated in your comment.

      March 26th, 2010
  6. Great post,

    Can this be applied if your taking your website from remotely to locally? I am interested in doing this, so that I can modify my site while people viewing it.

    April 21st, 2010
    • Yes, you can transfer a remote blog to your webserver after taking the above actions. The thing is, backup the entire blog in your computer, do the changes offline and then upload it in your web server.

      April 21st, 2010
  7. ssectore

    thanks, sidebar didn’t load but tutorial is great!

    May 28th, 2010
  8. Great, worked a treat. Although WordPress’s documentation is comprehensive, could never find something like this that was exactly what I wanted to do.

    June 4th, 2010
    • @Peter: Glad it helped. Feel free to ask more questions n WordPress, thanks for the comment

      June 4th, 2010
  9. when importing I got the next error message

    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: `blog`

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

    – Table structure for table `wp_commentmeta`

    CREATE TABLE IF NOT EXISTS `wp_commentmeta` (

    `meta_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `comment_id` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT ’0′,
    `meta_key` VARCHAR( 255 ) DEFAULT NULL ,
    `meta_value` LONGTEXT,
    PRIMARY KEY ( `meta_id` ) ,
    KEY `comment_id` ( `comment_id` ) ,
    KEY `meta_key` ( `meta_key` )
    ) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

    June 9th, 2010
  10. never mind
    I tried again and it worked

    June 9th, 2010
    • @asaf: I am glad the tutorial worked for you. Thanks for the comment

      June 9th, 2010
  11. Hey,
    Now there is another problem. Try to enter the site : http://www.myui.co.il. though it’s in hebrew, the problem is obvious.
    I followed all the steps, but the site doesn’t present itself good, the links don’t work, and there is no access to the database.

    Will it be the same if I create a new wordpress blog inside the server, and to override the wp-content directory ?

    I don’t know what to do

    June 11th, 2010
    • Yes, you can create another blog on the same server and re upload the wp-content directory. Won’t be an issue because the wp-content directory contains your uploads and plugins, themes

      June 12th, 2010
  12. Thank you,
    I fixed my mistake, the problem was, in the editing of the blog.sql, I changed all the links to http://www.myui.co.il/wordpress instead of just http://www.myui.co.il. the problem now, is that for some reason the footer.php, refuses to upload.

    June 13th, 2010
    • @asaf: Check your WordPress theme files for errors, switch to the default theme and see whether everything is fine or not.

      June 13th, 2010
  13. Thank you for the response.
    I tried the entire procedure over again, and now I have a problem with my database.
    Can you point out please what may cause a
    “Error establishing a database connection”

    asaf.

    June 15th, 2010
    • @asaf: Please check the wp-config.php file , you must have entered wrong database details or hostname address

      June 17th, 2010
  14. Mark

    Hi

    I’m getting the following error message when attempting to uploading the database, do you know why this is???

    Error

    SQL query:


    – Database: `hip_wordpress`

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

    – Table structure for table `wp_commentmeta`

    CREATE TABLE `wp_commentmeta` (
    `meta_id` bigint( 20 ) unsigned NOT NULL AUTO_INCREMENT ,
    `comment_id` bigint( 20 ) unsigned NOT NULL DEFAULT ’0′,
    `meta_key` varchar( 255 ) DEFAULT NULL ,
    `meta_value` longtext,
    PRIMARY KEY ( `meta_id` ) ,
    KEY `comment_id` ( `comment_id` ) ,
    KEY `meta_key` ( `meta_key` )
    ) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =5;

    MySQL said: Documentation
    #1046 – No database selected

    June 26th, 2010
    • @Mark: Have you disabled all the plugins before taking the database backup ?

      June 27th, 2010

Add Your Comment

All Comments are Moderated.

YOUR COMMENT



About This Site

Ampercent is a technology blog on computer tutorials, software guides, how to tricks and web tools. The blog is updated daily and written by two computer science students from India. Read More »



Subscribe to RSS Feed

Join Our Community

Submit Product For Review

Want a Software or a product to be reviewed ? Tell us about it, we will do the rest.