Skip to main content
1 of 4
Toto
  • 93
  • 1
  • 7

Converting from latin1 to utf8mb4 of ENUM and SET with accented characters on mysql

I am trying to convert tables from latin1 to utf8mb4 on MySQL 5.7.

Everything works fine except the tables with ENUM and SET which contains a value with an accented character. 2 types of errors are generated.

For exemple:

CREATE TABLE `car` (
  ...
  `color` enum('Rouge','Bleu foncé',...) DEFAULT NULL,
  ...
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

This query does not work:

> ALTER TABLE `car` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

#1265 - Data truncated for column 'color' at row 4

On other tables I get this error:

#1291 - Column 'origin' has duplicated value 'Cor?e' in ENUM
Toto
  • 93
  • 1
  • 7