MyISAM引擎
备份
mysqldump -u root -p --default-character-set=utf8 --opt --triggers -e -C -R dbname > bak_dbname.sql
恢复
mysql -u root -p --default-character-set=utf8 dbname < bak_dbname.sql
InnoDB引擎
备份
mysqldump -u root -p --default-character-set=utf8 --opt --triggers -e -C -R --single-transaction dbname > bak_dbname.sql
恢复
mysql -u root -p --default-character-set=utf8 --single-transaction dbname < bak_dbname.sql