How to Import or Export Large MySQL Databases Using Terminal

Create a Database Backup from Terminal

mysqldump -u mysql_user -h localhost -p mysql_database_name | gzip -9 > backup_file.sql.gz

Restore the Database Backup

zcat backup_file.sql.gz | mysql -u mysql_user -p mysql_database_name

Leave a Reply

Your email address will not be published. Required fields are marked *