mysql数据库,亿级别数据量,修改表结构中的字段类型

来源:互联网 发布:淘宝主播收入怎么算 编辑:程序博客网 时间:2024/04/27 22:41
直接改,似乎不太可行。
不如根据原来的表结构以及你要改的字段类型创建一个新的表:
原表为t, 新表为t2
1. create table t2(col1,....colN)其中包括你修正以后的某字段
2. insert into t2 select * from t
3. 将原表重命名备份:
   rename t to t_orig;
4. 将新表重命名为原表
   rename t2 to t;
0 0