dsfsd1123

IMPORT & EXPORT MYSQL

Exporting entire database:

mysqldump -u [user] -p [db_name] | gzip > [filename_to_compress.sql.gz] 

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

Export single/many table:

mysqldump -uroot --opt --databases DB_NAME --tables TABLE_NAME | gzip > /tmp/TABLE_NAME.export.sql.gz

Importing Compressed database:

gunzip < [compressed_filename.sql.gz]  | mysql -u [user] -p[password] [databasename] 
Note: There is no space between the keyword '-p' and your password.


gunzip < database.sql.gz | mysql -u user -p database

Reference: http://failshell.io/mysql/using-gzip-and-gunzip-with-mysql-to-importexport-backups/

Advertisement
0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like