I need to do what I do here for a whole table:
UPDATE users SET name = CONVERT(CAST(convert(name using latin1) as BINARY) USING utf8);
How do I do this with the ALTER TABLE query ?
I need to do what I do here for a whole table:
UPDATE users SET name = CONVERT(CAST(convert(name using latin1) as BINARY) USING utf8);
How do I do this with the ALTER TABLE query ?
Let's say columnA is defined as VARCHAR(25) CHARACTER SET latin1 then you can change it to utf8 so that it can have different values from different languages using below:
ALTER TABLE yourTable MODIFY columnA VARCHAR(25) CHARACTER SET utf8;
First of all, make sure that is the correct fix.
If I am not mistaken, you are trying to undo "double-encoding"?
See this for symptoms: Trouble with UTF-8 characters; what I see is not what I stored
See this for where the fix applies: http://mysql.rjweb.org/doc.php/charcoll#fixes_for_various_cases
Namely
CHARACTER SET utf8mb4 with double-encoding:
UPDATE tbl SET col = CONVERT(BINARY(CONVERT(col USING latin1)) USING utf8mb4);
Dump the table, load it somewhere else, run the conversion, test the results, especially getting SELECT col, HEX(col) ...