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.
- Begin by connecting to your site using SSH.
- 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:
- 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!