MySQL Replication提示错误Error You cannot ALTER a log table

作者:袖梨 2022-11-14

MySQL Replication 遇到下述错误讯息: (mysql> show slave status \G # 简化过的讯息如下)

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


MySQL Replication 遇到 Error 'You cannot 'ALTER' a log table if logging is enabled' on query. 修复

此篇有写解法:

MySQL replication Error 'You cannot 'ALTER' a log table if logging is enabled' on query

看来是 MySQL 的 show_query_log 的检查造成的问题, 先关掉让他执行过即可, 步骤如下:

1.SHOW SLAVE STATUS \G # 看问题是什么
2.STOP SLAVE;
3.SET GLOBAL slow_query_log = 'OFF'; SET GLOBAL sql_log_bin = 0; # 先关掉
4.START SLAVE;
5.SHOW SLAVE STATUS \G # 看是否正常启动了
6.SET GLOBAL slow_query_log = 'ON'; SET GLOBAL sql_log_bin = 1; # 改回来
7.到此即完成

相关文章

精彩推荐