MySQL修改字段出错: Data truncated for column ‘other‘ at row 1
完整的错误信息是:
MySQL [newdb]> alter table runoob_tbl modify other bigint not null default 100;ERROR 1265 (01000): Data truncated for column 'other' at row 1
心里一想,我这是按照教程来的,难道教程错了…
暗自在心里默念:我是煞笔,我是煞笔,我是煞笔…上网找答案去。
我要修改的是other字段,一开始添加的时候是默认null
所以在我修改的时候alter table runoob_tbl modify other bigint not null default 100;修改失败了
原因可能是:
-
表字段长度已经调整到足够长度;
-
修改的一列数据为NULL
然后我就删除了原有的other列,重新新增一列并设置默认值为10,然后再修改,就成功了。