Mysql Export Import through terminal

Standard

Mysql Export Import through terminal

Export:

mysqldump -p -u username from_mydb > to_mydb.sql

Compress:

tar -zcvf mydb.tar.gz mydb.sql

Decompress:

tar -zxvf mydb.tar.gz

Import

mysql -p -u username db_target < from_mydb.sql