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 的檢查造成的問題, 先關掉讓他執行過即可, 步驟如下:
- SHOW SLAVE STATUS \G # 看問題是什麼
- STOP SLAVE;
- SET GLOBAL slow_query_log = 'OFF'; SET GLOBAL sql_log_bin = 0; # 先關掉
- START SLAVE;
- SHOW SLAVE STATUS \G # 看是否正常啟動了
- SET GLOBAL slow_query_log = 'ON'; SET GLOBAL sql_log_bin = 1; # 改回來
- 到此即完成