导出数据库:
mysqldump -u root -p dbname > /usr/local/dbname.sql #全部导出
mysqldump -u root -p -d --add-drop-table dbname > /usr/local/dbname.sql #只导出表结构
当然需要压缩一下:
zip -r /usr/local/dbname.zip /usr/local/dbname.sql
导入时需要
mysql -u root -p dbname < dbname.sql
End.