Home Server Tutorials How To Export And Import MySQL Database In Gzip extension

How To Export And Import MySQL Database In Gzip extension

The following is the tutorial to export and import your MySQL Database in gzip extension.

Your SQL Backup file is compressed using Gzip tool so to make its size smaller (From .sql to be .gz).

And then to perform either importing or restoring your file, your database archive will be firstly extracted using gunzip. The following is the command.

How to exporst MySQL databse to gzip

mysqldump -u user_name -p database_name | gzip -9 > database_name.sql.gz

-9 : is the gzip compressing level (1-9).

How to import MySQL database from gzip

gunzip < database_name.sql.gz | mysql -u user_name -p database_name

LEAVE A REPLY

Please enter your comment!
Please enter your name here