mysqldump
备份整个
dump -u root -ppassword databasename >data.sql
//输入root密码即可
备份某个或多个表
mysqldump -u root -p databasename table1name table2name >data.sql
//输入root密码即可
只备份数据结构
mysqldump -u root -p databasename –no-data >data.sql
//输入root密码即可
恢复
mysql -u root -p –database=databasename
//输入root密码即可
备份:
/usr/local/mysql/bin/mysqldump –add-drop-table –all-databases –opt -f -uroot -pabc > /back/mysql-back.sql //整个数据库
tar czvf /back/mysql-back.tgz /back/mysql-back.sql
/usr/local/mysql/bin/mysqldump –add-drop-table –opt -f -uroot -p123 ywrc > /home/back/www/ywrc.sql //单个数据库
tar czvf /home/back/www/tar/ywrc-back.tgz /home/back/www/ywrc.sql
恢复:
mysql ywrc < ywrc.sql