Importing Databases Using WP-CLI

Last Updated -


WP-CLI is a great tool for simplifying various actions on your WordPress site. One of the great features of WP-CLI is the ability of import databases.

In this article, we'll show you how to import a database using WP-CLI. These actions can be performed easily in any environment provides WP-CLI support, including Pagely, of course.

  1. Begin by connecting to your site using SSH.
  2. Next, navigate to your WordPress site. If you're importing a database on a Pagely VPS or Enterprise account, the command would look like this:
    cd ~/sites/example.com
  3. Next, run the wp db import command, including the path to the database export that you want to import. For example, if you're importing a file named my_export.sql located in your home directory, the command would look something like this:
    wp db import ~/my_export.sql

Your database will now start importing. Depending on the size of the database, it might take a few minutes. Once the command completes, your database is successfully imported and ready to use!

Related Topics

Pagely is the Managed WordPress Hosting Platform designed to exceed the needs of media, business, and Enterprise customers alike. We help the world's biggest brands scale WordPress.

Copyright © 2006-2017 Pagely, Inc. All rights reserved.
Pagely® and WordPress® are registered trademarks.

Pagely
Powered by Zendesk