Search code examples
mysqlalter

Mysql alter comment column only


I'm wondering if it's possible to change only comment on a column in mysql without change the column definition data like name, type and key.

Example:

ALTER TABLE `user` CHANGE `id` `id` INT(11) COMMENT 'id of user' 

Can i change only the comment is this example ?

Thanks in adavance.


Solution

  • According to the MySQL specification, you must repeat the entire column definition if you want to redefine the comment:

    ALTER TABLE user MODIFY id INT(11) COMMENT 'id of user';