MySQL Cluster

Backup and Restore Mysql database table

Dump and restore from .sql

Dump

mysqldump db_name table_name > table_name.sql

Restore

mysql -u <user_name> -p db_name
mysql> source <full_path>/table_name.sql

or in one line

mysql -u username -p db_name < /path/to/table_name.sql


Dump and restore from a compressed (.sql.gz) format

Dump

mysqldump db_name table_name | gzip > table_name.sql.gz

Restore

gunzip < table_name.sql.gz | mysql -u username -p db_name

 

mysqldump can take a tbl_name parameter, so that it only backups the given tables.

mysqldump -u -p yourdb yourtable > c:\backups\backup.sql

Leave a Reply