Import a gzipped dump into the WordPress database
restore wordpress database backup | import sql file into wordpress | wp db import gz file | wp-cli | database | backup | restoreWarning, destructive. This command deletes, overwrites or changes data in a way that cannot easily be undone. Check every placeholder carefully and make a backup first.
gunzip -c /var/www/vhosts/example.com/db-backup.sql.gz | wp db import - --path=/var/www/vhosts/example.com/httpdocsDecompresses the dump as a stream and imports it using the credentials from wp-config.php. If the dump contains DROP TABLE statements (the mysqldump default), existing tables are replaced. Import uncompressed files directly with wp db import file.sql.
Note: Back up the current state with wp db export first. If the table prefix in the dump does not match $table_prefix in wp-config.php, WordPress will not find the data.
Also searched as
- restore wordpress database backup
- import sql file into wordpress
- wp db import gz file