How to use gzip or gunzip with mysqldump/mysql to import/export

You, UnixMySQL
Back

The syntax is fairly easy and it is a common practice to use gzip specially when you transfer your backup files over two or more different servers so here is the syntax.

Exporting:

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

Importing:

gunzip < database.sql.gz | mysql -u user -p database
© Heshan Wanigasooriya.RSS

🍪 This site does not track you.