Montag, 27. Juli 2015

MySQL: Dump database and compress it from command line via mysqldump

The following command does the job:

mysqldump -uUSERNAME -pPASSWORD --databases DATABASE --lock-all-tables | gzip -9 -c > DATABASE.sql.gz

If the database is very big and you want to check the created SQL, use the following command after unpacking the Gzip archive:

head -n 10 DATABASE.sql

Keine Kommentare:

Kommentar veröffentlichen