Documentation Home
MySQL Globalization
Related Documentation Download this Excerpt
PDF (US Ltr) - 497.1Kb
PDF (A4) - 495.8Kb


1.14.2 Choosing a Collation ID

Each collation must have a unique ID. To add a collation, you must choose an ID value that is not currently used. MySQL supports two-byte collation IDs. The range of IDs from 1024 to 2047 is reserved for user-defined collations.

The collation ID that you choose appears in these contexts:

  • The ID column of the Information Schema COLLATIONS table.

  • The Id column of SHOW COLLATION output.

  • The charsetnr member of the MYSQL_FIELD C API data structure.

  • The number member of the MY_CHARSET_INFO data structure returned by the mysql_get_character_set_info() C API function.

To determine the largest currently used ID, issue the following statement:

mysql> SELECT MAX(ID) FROM INFORMATION_SCHEMA.COLLATIONS;
+---------+
| MAX(ID) |
+---------+
|     247 |
+---------+

To display a list of all currently used IDs, issue this statement:

mysql> SELECT ID FROM INFORMATION_SCHEMA.COLLATIONS ORDER BY ID;
+-----+
| ID  |
+-----+
|   1 |
|   2 |
| ... |
|  52 |
|  53 |
|  57 |
|  58 |
| ... |
|  98 |
|  99 |
| 128 |
| 129 |
| ... |
| 247 |
+-----+
Warning

Before upgrading, you should save the configuration files that you change. If you upgrade in place, the process replaces the modified files.