mysql列名修改 mysql中如何修改列名? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 alter tabe ... oldName newName datatypemysql> create table t5 ( id int, col int);Query OK, 0 rows affected (0.11 sec)mysql>mysql> alter table t5 CHANGE col fld int;Query OK, 0 rows affected (0.06 sec)Records: 0 Duplicates: 0 Warnings: 0mysql> desc t5;+-------+---------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+---------+------+-----+---------+-------+| id | int(11) | YES | | NULL | || fld | int(11) | YES | | NULL | |+-------+---------+------+-----+---------+-------+2 rows in set (0.03 sec)mysql> alter table tt CHANGE f1 f2 int alter table tt modify f1 f2或者alter table change f1 f1 varchar -- My SQL 集群搭建成功 -- 看看这mysql语句错在哪里啊 insert 的时候奇怪的问题! 执行该mysql语句很慢 with rollup 遇到了问题,在线等解 急急,求高手解答触发器错误 select中查询的变量的是个数值型变量怎么办? 关于mysql插入空值的处理 求存储过程 关联查询问题 问个linux下mysql自动启动的问题 一个表内的某个字段是vachar型,内容可能是gb2312,也可能是big5,怎么办才能避免乱码?
Query OK, 0 rows affected (0.11 sec)mysql>
mysql> alter table t5 CHANGE col fld int;
Query OK, 0 rows affected (0.06 sec)
Records: 0 Duplicates: 0 Warnings: 0mysql> desc t5;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| fld | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.03 sec)mysql>
或者
alter table change f1 f1 varchar