MySQL修改字段名:
ALTER TABLE 表名 CHANGE [column] 旧字段名 新字段名 新数据类型; mysql> alter table white_user change column name nick_name varchar(50) null comment '昵称'; -- 正确 Query OK, 0 rows affected (0.02 sec) Records: 0 Duplicates: 0 Warnings: 0
mysql修改表名
ALTER TABLE 旧表名 RENAME TO 新表名 ; mysql> show tables ; +-------------------+ | Tables_in_db_test | +-------------------+ | white_user | +-------------------+ 1 row in set (0.00 sec) mysql> alter table white_user rename to white_user_new ; Query OK, 0 rows affected (0.00 sec) mysql> show tables ; +-------------------+ | Tables_in_db_test | +-------------------+ | white_user_new | +-------------------+ 1 row in set (0.00 sec)