2013-05-16 5 views
6

Ho appena visto che MySQL 5.5 offre utf8_general_mysql500_ci come confronto.MySQL - Cos'è utf8_general_mysql500_ci?

Qual è la differenza con altre regole di confronto come utf8_general_ci?

Devo usare meglio utf8_general_mysql500_ci?

risposta

7

Come documentato in 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)

+0

@Downvoter: Cura di commentare? – eggyal