mysql version :5.5
mysqldump -uroot -p --default-character-set=utf8 --disable-keys --opt --extended-insert=false --triggers -R --all-databases > /home/mysqlbackup/all_backup.sql
Enter password:
-- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES
问题原因:
1.warning的原因是因为mysqldump默认是不备份事件表的,只有加了--events 才会,加上--events --ignore-table=mysql.events参数即可;
2.error 1142 是因为在mysql5.5中,增加了performance_schema,当我们进行mysqldump的时候会报错,在mysqldump中加上参数 --skip-lock-tables就可以了
最终备份语句可以这样:
mysqldump -uroot -p --default-character-set=utf8 --disable-keys --opt --extended-insert=false --triggers -R--events --ignore-table=mysql.events--skip-lock-tables --all-databases > /home/mysqlbackup/all_backup.sql