create user ‘backup’@’localhost’ identifiedby ‘’;
grant select, reload, lock tables,replication client, show view, event, view, process on *.* to‘backup’@’localhost’;
mysqldump –ubackup –p –master-data=2–single-transaction –routines –triggers –events mc_orderdb >mc_orderdb.sql 备份一个库
mysqldump –ubackup –p –master-data=2–single-transaction –routines –triggers –events mc_orderdb table_nametable_name…> xxx.sql 备份表
mysqldump –ubackup –p –master-data=1 –single-transaction –routines –triggers–events –all-databases > db.sql 备份整个实例
mysqldump –ubackup –p –master-data=2–single-transaction –routines –triggers –events –tab=’/xx/xxx’ mc_orderdb >xxx.sql 分表结构和数据分开备份
mysql需对/xx/xxx可写权限
mysqldump –ubackup –p –master-data=2–single-transaction –where=”order_id> 1000 and order_id <1050” mc_orderdbtable_name > xxx.sql where条件的单表备份
原文:http://90sirdb.blog.51cto.com/8713279/1917203