天天看點

mysql 5.5 Warning: Skipping the data of table mysql.event&&mysqldump: Got error: 1142

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

繼續閱讀