Import a gzipped SQL dump into a database
import mysql dump | restore database backup | import sql.gz file | mysql | mariadb | import | 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/wp_example.sql.gz | mysql -u dbuser -p wp_exampleDecompresses the backup without creating an intermediate file and passes the SQL statements to the MySQL client. Dumps from mysqldump contain DROP TABLE by default, so existing tables with the same name are replaced. Import uncompressed files with mysql -u dbuser -p wp_example < file.sql.
Note: Back up the current state first. The target database must exist unless the dump contains CREATE DATABASE.
Also searched as
- import mysql dump
- restore database backup
- import sql.gz file