0

I have a Wordpress website published on a remote PC. I want to back it up it totally on my local CentOS PC, including posts, images, videos, etc.

Here is what I have done:

  1. Download and install Wordpress on my local PC.
  2. Back up the MySQL database on the remote PC using this command:

    mysqldump --user=root --password=XXXXXX --opt wordpress > wordpressBK.sql
    
  3. Restore the MySQL database on my local PC using this command

    mysql --user=root --password=XXXXXXX wordpress < /home/mysqlDB/wordpressBK.sql
    

Now when I open my browser and go to http://localhost, the backup seems successful, but the URLs of topics and images in Wordpress still go to my remote Wordpress address (e.g. http://www.AAABBBCCC.com/?p=1365)

What I want is to copy everything to my local PC. How can I manually complete this backup?

If possible, I would prefer not to install plugins.

thank to the reply , after I change site URL in mysql DB ,it works here is what statement I execute

UPDATE wp_options SET option_value = replace(option_value, 'http://www.XXXXXXXX.com', 'http://192.168.3.116') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.XXXXXXXX.com','http://192.168.3.116');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.XXXXXXXX.com', 'http://192.168.3.116');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.XXXXXXXX.com','http://192.168.3.116');
1
  • That is because the configuration of the Wordpress install is pointing to the remote host. I'm not sure what you'd have to do in order to have a functional local backup. Typically, you'd go into the wpconfig file and the database (usually via the admin page, but also doable through direct db edits) and change the url and local file paths for Wordpress. But the issue is that you're confusing two things: creating a working copy, and backing up. A backup is not typically intended to be functional, but only exists in order to be restored to the original location. Decide what you really need. Commented Feb 20, 2019 at 17:57

1 Answer 1

0

Login to the admin (if you can) and update the site URL to your local machine address. OR (if you can't login to admin) access the database and change the URL there to the new one. Instructions on both these and one or two more can be found here: https://codex.wordpress.org/Changing_The_Site_URL

Hope that helps!

Not the answer you're looking for? Browse other questions tagged .