Sail Knowledgebase

How to Import a WordPress Database Backup with Sail CLI

In this article you will learn how to use the sail db import command to import a database backup to your production WordPress site.

If you like Sail, don't forget to give us a star on GitHub!

Sail db import

Sail allows to import any .sql or .sql.gz file to the production database with sail db import:

sail db import path/to/database-backup.sql.gz

Note that this will overwrite your existing database in production and it is recommended that you make a database backup first. Also note that importing a database does not affect the database credentials defined in the wp-config.php file.

To reset the database credentials and update wp-config.php, use:

sail db reset-password

If you're having trouble with importing/exporting database files with Sail, please refer to our getting help section.