extract and reload mysql database — GZIP on the fly.

To dump a mysql database use the mysqldump command and pipe it to gzip on the fly so the resulting backup file is compressed with this command:

mysqldump -u[uname] -p [dbname] | gzip – > backupfilename.dmp.gz

To restore this on another machine you need to create the databse using mysqladmin

mysqladmin -u[uname] -p create schemaname

Then load the data with

gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname]

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published.