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

OpenAI Astra十题拆解:2000美元,十个数学难题,一次破壁

  • u2
  • 8月 3, 2026
  • 53 views

便宜电视盒子背后的广告欺诈帝 国

  • u2
  • 7月 31, 2026
  • 54 views

Snowflake Cortex AI Gateway:企业 AI Agent 的「信任控制平面」

  • u2
  • 7月 29, 2026
  • 69 views

国产算力训出万亿大模型:美团LongCat-2.0的技术突围

  • u2
  • 7月 28, 2026
  • 81 views

AI逃逸事件全解析:OpenAI模型自主攻破Hugging Face,安全范式正在重构

  • u2
  • 7月 24, 2026
  • 109 views

Kimi K3 冲击波:2.8 万亿参数的野心,和它背后的三场技术硬仗

  • u2
  • 7月 20, 2026
  • 227 views