6 steps to create local copy of your live WordPress site

I know there are bunch of other posts on how to create local copy of your live WordPress site, however, they are too much descriptive. Here I will show you step by step approach rather than descriptive one.
1. Export your live database into an sql file.
2. Download/Copy your live WordPress site folder to your local machine.
3. Move your downloaded WordPress site files inside local server’s web root.
4. Open exported sql file using notepad or any other editor of your choice and replace “http://www.yoursite.com” with “http://localhost/wordpress” and Save that file. (CAUTION: This file could be very large so replacing might take time. Command for replacing file content on *nix based system.)
5. Import database from that sql file into your local mysql database.
6. Open wp-config.php file which you can find inside your copied WordPress folder. In that file replace DB_NAME with your local WordPress database which you imported in above step. DB_USER with database user name. DB_PASSWORD with database password.
That’s it you are done.


Blank page in browser?
  1. First disable All active plugins. Find out active plugins By executing following sql.
    SELECT * FROM wp_options WHERE option_name = 'active_plugins';
  2. Copy contents of option_value column into safe place. This step is required to keep backup of which plugins were active in order restore them later.
    UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';
Want to change user name and password of local WordPress site user?
  1. Execute following sql to list all the users
    SELECT * FROM `wp_users`
  2. Look for user name inside “user_login” column for which you want to execute following sql also note down its “id” from “id” column.
  3. Following sql will change user name and password of desired user.
    UPDATE wp_users SET user_login=':user_login', user_pass=md5(':password') where id=:id;
    In above sql replace following placeholders
    1. :user_login with desired user name
    2. :password with desired password
    3. :id with id you found in 2nd step


Popular posts from this blog

How to get local time from UTC using Moment.JS

Step by step Cordova calabash-ios automation

Measure the height of keyboard on PhoneGap app using jQuery