表250万行,可能是磁盘空间不够(存放数据的盘只有5G空闲空间)的情况下出现失败:

ALTER TABLE pre_answers_caiji9 ENGINE=InnoDB
1114 - The table '#sql-6b33_1d98828' is full

分步操作,新建表再复制数据的方式进行:

CREATE TABLE pre_answers_caiji9_new LIKE pre_answers_caiji9;
ALTER TABLE pre_answers_caiji9_new ENGINE=InnoDB;

INSERT INTO pre_answers_caiji9_new SELECT * FROM pre_answers_caiji9 WHERE id BETWEEN 1 AND 1000000;
INSERT INTO pre_answers_caiji9_new SELECT * FROM pre_answers_caiji9 WHERE id BETWEEN 1000001 AND 2000000;
-- 继续插入剩余的数据, 一次1百万行太久,可降低到10万...

-- 重命名表
RENAME TABLE pre_answers_caiji9 TO pre_answers_caiji9_old, pre_answers_caiji9_new TO pre_answers_caiji9;

--删除旧表
DROP TABLE pre_answers_caiji9_old;

标签: none

添加新评论