,

MySQL – Dump and Restore a Database

1. MySQL – Dump


mysqldump -h HOSTNAME -u USERNAME --password=PASSWORD DBNAME > dbdump.sql

Compress SQL Dump(Optional):


 bzip2 dbdump.sql

2. MySQL – Restore

Decompress SQL Dump(Optional):


bzip2 -d dbdump.sql.bz2


mysql -h HOSTNAME -u USERNAME --password=PASSWORD DBNAME <  dbdump.sql


Comments

Leave a Reply

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