X

MySQL Replication 遇到 Error 'You cannot 'ALTER' a log table 修復

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. 到此即完成
Tsung: 對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.
Related Post