MySQL从库Error:“You cannot ‘Alter‘ a log table...“

Posted DATA数据猿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL从库Error:“You cannot ‘Alter‘ a log table...“相关的知识,希望对你有一定的参考价值。

mysql从库Error:“You cannot ‘Alter’ a log table…”

Error 'You cannot 'ALTER' a log table if logging is enabled' on query. Default database: 'mysql'. Query: 'ALTER TABLE slow_log

导致报错的原因

mysql_upgrade执行的所有语句都被记二进制记录,然后复制到slave,导致报错

解决方式一:

停止复制线程,关闭慢查询日志,当前错误可恢复

stop slave;
set global slow_query_log="OFF";
start slave;
set global slow_query_log="ON";

解决方式二:

跳过该错误步骤

stop slave;
# 使用命令跳过当前错误语句,sql_slave_skip_counter可以指定跳过多少步
set global sql_slave_skip_counter=1;
start slave;

以上是关于MySQL从库Error:“You cannot ‘Alter‘ a log table...“的主要内容,如果未能解决你的问题,请参考以下文章