mysql slave error:You cannot ‘ALTER’ a log table

mysql执行了mysql_upgrade后从库同步报错,’You cannot ‘ALTER’ a log table if logging is enabled’ on query. 报错显示跟mysql的slow_query log(慢日志)相关:


具体错误信息如下:

mysql> SHOW SLAVE STATUS\G
               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               
   MODIFY start_time TIMESTAMP NOT NULL,
   MODIFY user_host MEDIUMTEXT NOT NULL,
   MODIFY query_time TIME NOT NULL,
   MODIFY lock_time TIME NOT NULL,
   MODIFY rows_sent INTEGER NOT NULL,
   MODIFY rows_examined INTEGER NOT NULL,
   MODIFY db VARCHAR(512) NOT NULL,
   MODIFY last_insert_id INTEGER NOT NULL,
   MODIFY insert_id INTEGER NOT NULL,
   MODIFY server_id INTEGER UNSIGNED NOT NULL,
   MODIFY sql_text MEDIUMTEXT NOT NULL'
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 6512
1 row in set (0.00 sec)

修复方案:

#停掉slave
STOP SLAVE;

#Disable the relevant logs (don't copy+paste this but check your own configuration first!):
SET GLOBAL slow_query_log = 'OFF';

#启动slave
START SLAVE;

#检查slave 状态
SHOW SLAVE STATUS\G

#set slow_query_log on and enable the relevant logs again:
SET GLOBAL slow_query_log = 'ON';

现在slave已经可以同步了。

u2

Related Posts

mysql连接失败:The driver has not received any packets from the server

解决java spring连接mysql报错问题,增加连接串参数

Read more

python cx-Oracle 驱动安装

安装oracle驱动 cx-Oracle驱动二进制版本下载地…

Read more

You Missed

本地AI时代来临:Ollama + MemPalace工作流深度指南

  • u2
  • 4月 21, 2026
  • 81 views

Raycast深度解析:这个让Mac效率重装升级的东西,到底值不值?

  • u2
  • 4月 14, 2026
  • 73 views

GitHub 25K+星标!Onyx:开源可自托管的企业级AI聊天与RAG平台

  • u2
  • 4月 8, 2026
  • 186 views

InternVL-U 统一多模态模型

  • u2
  • 4月 3, 2026
  • 162 views
InternVL-U 统一多模态模型

Everything Claude Code:开源 Agent 性能优化框架

  • u2
  • 3月 31, 2026
  • 189 views

MiroFish:群体智能预测引擎,让未来在数字沙盘中预演

  • u2
  • 3月 29, 2026
  • 275 views