How To Restore WordPress Website From Backup

WordPress is widely used in current website building. And backup is very important. This article will show you how to restore a WordPress website from a previous backup file.

  1. Login to your WordPress website admin console. And download the latest website backup file. I use the BackWPup WordPress plugin to create the website’s daily backup.
  2. So I click the BackWPup —> backups menu in the WordPress dashboard left panel to list all the backup files on the page right side.
  3. Click the Download link on the right side backup file row to download the backup file.
  4. After download, extract the zip file to a local folder. And then copy all the files in the folder to your local website root folder. My local website folder is C:\xampp\htdocs\wordpress.
  5. Please note the .sql file in the unzipped folder, in my example, the .sql file is backwpup_13910f01_twothrp0_ss_dbnamedcb.sql. This file is the website database backup file. From the file name, we can see the database name is twothrp0_ss_dbnamedcb.
  6. Open a MySQL admin manager, I use SQLyog community version. Right-click left panel, click ” Create Database” menu to create database twothrp0_ss_dbnamedcb in it. Please Note the database charset should choose utf8 and database collation should choose utf8_bin.
  7. Right-click the database name, click ” Import —> Execute SQL scripts… ” to select the above database backup SQL file to execute.
  8. When execution complete, press F5 to refresh the left panel tree, you can see all backup tables and data that has been added to the database.
  9. Right-click wp_uhau_options table, click ” Open Table ” in the popup menu list. And change the siteurl and home column value to your local URL in the right panel. My local siteurl and home value is http://localhost/wordpress/. Do not forget to click the blue soft disk icon in the table data list top toolbar to save your update.
  10. Open the wp-config.php file which saved in your local website root folder like C:\xampp\htdocs\wordpress in a text file editor. Get the database user name and password from the file like below.
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define( 'DB_NAME', 'db_name' );
    /** MySQL database username */
    define( 'DB_USER', 'db_user' );
    /** MySQL database password */
    define( 'DB_PASSWORD', 'db_password' );
    /** MySQL hostname */
    define( 'DB_HOST', 'db_host' );
    /** Database Charset to use in creating database tables. */
    define( 'DB_CHARSET', 'utf8' );
    /** The Database Collate type. Don't change this if in doubt. */
    define( 'DB_COLLATE', '' );
  11. Create a user account with the above username and password in MySQL server use SQLYog. Do not forget to assign all privileges for operating database twothrp0_ss_dbnamedcb to the user.
  12. Now open a web browser, browse URL http://localhost/wordpress/wp-admin, and log in to the admin console. If you see the error message Error establishing a database connection that means the database user privileges are not granted correctly.
  13. You should change the user Host to localhost and restart the MySQL server in XAMPP to make it take effect.
  14. Now login to the WordPress admin manager dashboard again.
  15. Click the ” Settings —> General ” menu in the left panel, do not edit any field, just click the ” Save Changes ” button on the page right side to save it.
  16. Click the ” Settings —> Permalink ” menu in the left panel, also do not edit any field, just click the ” Save Changes ” button on the page right side to save it.
  17. You can also change plugins or check WordPress update in the admin console.
  18. Now the restore WordPress website from backup file process completes successfully.
  19. Logout admin console, browse URL http://localhost/wordpress/, you can find your local website execute normally.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.