How To: Migrate WordPress Website using Windows


  • You have a LAMP (Linux, Apache, MySQL, PHP) OR LEMP (Linux, Nginx, MySQL, PHP) server operating on a recent version of Ubuntu (or other Debian-based OS)


  • Install PuTTY program (available on Windows, Mac, Linux)
  • Install WinSCP program

Export Source Website

  1. Using PuTTY, remotely connect the server hosting your Source website
  2. Run:
    $ mkdir wp-backup
  3. Run:
    $ sudo cp -r /var/www/html /home/gizmo/wp-backup
  4. Run:
    $ cd /home/gizmo/wp-backup/
  5. Backup the MySQL Database with:
    $ mysqldump -u old_db_username -p old_database_name > wordpress.sql
  6. Verify you have two items in wp-backup:
    $ cd ~/wp-backup
  7. Using WinSCP, remote connect to your Source website (similar to PuTTY)
  8. Transfer the entire wp-backup directory from your remote server to your Windows Desktop C:\Users\user\Desktop\

New Server Preparation

  1. On the new WordPress server, make sure the Apache (or Nginx) service and MySQL database service are both operational. Do NOT configure the WordPress installation at this time.
  2. Create a new empty WordPress database:
    $ mysql -u root -p
    MYSQL > GRANT ALL ON new_db_name.* TO 'new_db_user'@'localhost' IDENTIFIED BY 'password';

Import Source Website to New Server

  1. Using WinSCP, remotely connect to the new server
  2. Transfer the wp-backup folder from your Windows desktop and target the /home/gizmo/ on the new server
  3. Once the transfer is complete, log into the new server using PuTTY
  4. Import the old database:
    $ cd /home/gizmo/wp-backup/
    MYSQL -u new_db_user -p new_db_name < wordpress.sql

Modify wp-config.php

  1. Edit the old wp-config.php file with the new database information (change the define:
    $ sudo nano /home/gizmo/wp-backup/html/wp-config.php
    • Modify define(‘DB_NAME’), define(‘DB_USER’), and define(‘DB_PASSWORD’) as necessary

Set the WordPress Files and Permissions

  1. Note: If your server has WordPress installed at this point, you will have to remove ALL WordPress files from /var/www/html/ before continuing:
    $ sudo rm -rf /var/www/html/*
  2. Copy the WordPress files:
    $ sudo cp -a /home/gizmo/wp-backup/html/. /var/www/html/
  3. Set the proper permissions on the copied files:
    $ sudo chown -R gizmo:www-data /var/www/html
    $ sudo find /var/www/html -type d -exec chmod g+s {} \;
    $ sudo chmod g+w /var/www/html/wp-content
    $ sudo chmod -R g+w /var/www/html/wp-content/themes
    $ sudo chmod -R g+w /var/www/html/wp-content/plugins
  4. Verify your old site is operational!
  5. Remove the copy of the old files:
    $ sudo rm -rf /home/gizmo/wp-backup/
Leave a Reply

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

Icons made by Smashicons from is licensed by CC 3.0 BY