Skip to main content
Keep Your Business Open During COVID-19Learn More
Call us
Phone numbers and hours
Help Center

Explore our online help resources

Help

WordPress Help

Export and import a database with WP-CLI

WP-CLI is a command line tool that helps you perform different actions on your WordPress site. If you're comfortable with using SSH commands, you'll notice that WP-CLI has simplified commands created for WordPress sites. Here's how you can use the database export and import commands available to WP-CLI.

Required: You'll need the following to complete these steps:
Note: If you have a VPS or DED Server, you need to install WP-CLI before you can start using it. WP-CLI is not available on our Windows Hosting plans.

Export the database with WP-CLI

  1. Connect to your hosting account with SSH.
  2. Use the bash command ls to list files and folders, and cd and ../ to move through directories until you're in the directory with your WordPress files.
  3. Enter the following command:
    wp db export filename.sql
    • In the command above, you should replace filename.sql with the name you want to use for the backup file.

You'll see a success message once the export is complete. Larger databases will take longer to export.

Import the database with WP-CLI

  1. Upload the SQL backup file to the folder with your WordPress files using FTP or File Manager.
  2. Connect to your hosting account with SSH.
  3. Use the bash command ls to list files and folders, and cd and ../ to move through directories until you're in the directory with your WordPress files.
  4. Enter the following command:
    wp db import filename.sql
    • In the command above, you should replace filename.sql with the actual name of your backup file.

You'll see a success message once the import is complete. Larger databases will take longer to import.

More info

  1. If you don't have WP-CLI available on your server, you can use standard SSH commands to export and import databases.
  2. Find and replace for WordPress with SSH