mysqldump: Got error: 1556: You can't use locks with log tables. when doing LOCK TABLES

mysqldump 备份全库时,出现下述错误:

mysqldump: Got error: 1556: You can't use locks with log tables. when doing LOCK TABLES

原因:

mysqldump备份的时候不能锁mysql.general_log,mysql.slow_log这两张表。

mysql> select table_name, engine from tables where table_name in ('general_log','slow_log');
+-------------+--------+
| table_name  | engine |
+-------------+--------+
| general_log | CSV    |
| slow_log    | CSV    |
+-------------+--------+
2 rows in set (0.00 sec)


解决办法有四种:


1.不备份mysql这个schema


2.备份时排除这两张表'mysql.general_log' 'mysql.slow_log'


3.不备份CSV引擎的表
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE NOT IN('CSV');


4.mysqldump备份时增加参数--lock-tables=0


 

你可能感兴趣的:(mysqldump: Got error: 1556: You can't use locks with log tables. when doing LOCK TABLES)