mysqlutf-8character-encoding

MySQL: set column charset


I have an existing table and I want to convert the character set only for one specific column to UTF-8.

I know that this command ALTER TABLE table_name CONVERT TO CHARACTER SET utf8 does it for the whole table but I'm looking for a column-specific command.

Is there a command for that?


Solution

  • Try this:

    ALTER TABLE t MODIFY col1 CHAR(50) CHARACTER SET utf8mb4;