修改mysql字段类型,修改字段名

时间:2023-03-09 19:30:18
修改mysql字段类型,修改字段名


修改字段类型(数据类型,长度,默认值)

alter table user modify user_name 类型   

修改字段名

方法一:alter table 表 change 旧字段名  新字段名  新数据类型
例如 alter table user change user_name user_name1 varchar(10) 方法二:alter table 表名 rename column z to x
例如: alter table user rename column user_name to user_name1