MySQL - What's utf8_general_mysql500_ci?
Asked Answered
G

1

8

I just saw that MySQL 5.5 offers utf8_general_mysql500_ci as collation.

What is the difference to other collations like utf8_general_ci?

Should I better use utf8_general_mysql500_ci?

Gamal answered 16/5, 2013 at 13:58 Comment(0)
T
10

As documented under Changes in MySQL 5.5.21:

  • New utf8_general_mysql500_ci and ucs2_general_mysql500_ci collations have been added that preserve the behavior of utf8_general_ci and ucs2_general_ci from versions of MySQL previous to 5.1.24. Bug #27877 corrected an error in the original collations but introduced an incompatibility for columns that contain German 'ß' LATIN SMALL LETTER SHARP S. (As a result of the fix, that character compares equal to characters with which it previously compared different.) A symptom of the problem after upgrading to MySQL 5.1.24 or newer from a version older than 5.1.24 is that CHECK TABLE produces this error:

    Table upgrade required.
    Please do "REPAIR TABLE `t`" or dump/reload to fix it!
    

    Unfortunately, REPAIR TABLE could not fix the problem. The new collations permit older tables created before MySQL 5.1.24 to be upgraded to current versions of MySQL.

    To convert an affected table after a binary upgrade that leaves the table files in place, alter the table to use the new collation. Suppose that the table t1 contains one or more problematic utf8 columns. To convert the table at the table level, use a statement like this:

    ALTER TABLE t1
    CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci;
    

    To apply the change on a column-specific basis, use a statement like this (be sure to repeat the column definition as originally specified except for the COLLATE clause):

    ALTER TABLE t1
    MODIFY c1 CHAR(N) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci;
    

    To upgrade the table using a dump and reload procedure, dump the table using mysqldump, modify the CREATE TABLE statement in the dump file to use the new collation, and reload the table.

    After making the appropriate changes, CHECK TABLE should report no error.

    For more information, see Checking Whether Tables or Indexes Must Be Rebuilt, and Rebuilding or Repairing Tables or Indexes. (Bug #43593, Bug #11752408)

Turves answered 16/5, 2013 at 14:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.