我有 1 个主 mysql 进程和 2 个从属进程。
今天我在两个从属设备上都看到:
查询时出现错误“表”
bgbilling
。contract_status_balance_dump
'已存在'。默认数据库:'bgbilling'。查询:'CREATE TABLE contract_status_balance_dump( UNIQUE(cid) ) SELECT cid, MAX(yy*12+(mm-1))%12 + 1 AS mm,FLOOR(MAX(yy*12+(mm-1)) / 12) AS yy FROM contract_balance GROUP BY cid'
“显示表格”不显示该表。
我尝试停止从属,并执行“drop table contract_status_balance_dump”但是:
错误 1051 (42S02):未知表“contract_status_balance_dump”
这怎么可能?如何解决?
答案1
以下是修复方法
STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
use bgbilling
DROP TABLE IF EXISTS contract_status_balance_dump;
CREATE TABLE contract_status_balance_dump( UNIQUE(cid) )
SELECT cid, MAX(yy*12+(mm-1))%12 + 1 AS mm,FLOOR(MAX(yy*12+(mm-1)) / 12) AS yy
FROM contract_balance GROUP BY cid;
START SLAVE;
SHOW SLAVE STATUS\G
答案2
确保在检查从属服务器时,您正在“bgbilling”数据库中运行命令“ls bgbilling/contract_status_balance_dump”。希望这对您有帮助,祝您好运 :)