mysqldump账户需要什么权限?

【mysqldump所需权限】

mysql> create user dumper@'%';
mysql> grant select on *.* to dumper@'%';
mysql> grant show view on *.* to dumper@'%';
mysql> grant lock tables on *.* to dumper@'%';
mysql> grant trigger on *.* to dumper@'%';
mysql> grant process on *.* to dumper@'%';
mysql> grant event on *.* to dumper@'%';
mysql> grant reload on *.* to dumper@'%';
mysql> grant replication client on *.* to dumper@'%';

【最佳实践】

create user dumper@'10.192.4.6' identified by 'ask.9_1bn;qqq=;u';
grant select,trigger,show view,lock tables,process,event,reload,replication client on *.* to dumper@'10.192.4.6';

 备份表结构:

#备份表结构:
mysqldump -udumper -p'ask.9_1bn;qqq=;u' -h 10.192.4.8 --set-gtid-purged=OFF --single-transaction --master-data=2 --lock-tables \
--triggers --routines --events --max_allowed_packet=67108864 -d -B test > test_nodata_`date +%Y%m%d`.sql

参数:--lock-tables  为解决 myisam 表一致性问题

 

posted @ 2021-07-29 09:54  郭大侠1  阅读(595)  评论(0编辑  收藏  举报