一先建立备份账号
create user ‘backup‘@‘localhost‘ identified by ‘pass4word‘;
二赋予权限
grant select,reload,lock tables,replication client,show view,event,process on *.* to ‘backup‘@‘localhost‘;
附加,查看创建表的语句
show create table table_name;
三备份单个数据库
mysqldump -ubackup -ppass4word --master-data=2 --single-transaction --routines --triggers --events tk_test >tk.sql