1. 程式人生 > >Linux 下使用Dump操作MySQL資料庫

Linux 下使用Dump操作MySQL資料庫

Exporting a Compressed MySQL Dump

This command will dump a MySQL database, compress it on-the-fly and save it to a file. Replace keywords between { and } with their proper values (while also removing the brackets of course).

1 mysqldump -u {user} -p {database} | gzip > {database}.sql.gz

Usually I prefer to use a slightly different variation and prepend the date. This is useful if you’ve done a dump before and want to avoid overwriting it, etc. And most importantly: its cleaner.