Sail Knowledgebase

How to Create a WordPress Database Backup with Sail CLI

In this article you will learn how to use the sail db export command to create and download a WordPress database backup from your production server.

If you like Sail, consider sponsoring us via GitHub!

Sail db export

To create a database export from your production site, simply run:

sail db export

This will perform a new database dump on your production server, compress it and download it to your local .backups directory. To view all available database backups in your local working copy, simply run:

cd /path/to/project
ls -lh .backups

Note that the database backups well have the .sql.gz extension, while the full site backups will have a .tar.gz extension. To import a database backup to your production server run sail db import. You can learn more about it here.

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