Each collation must have a unique ID. To add a new collation, you must choose an ID value that is not currently used. The value must be in the range from 1 to 254. The collation ID that you choose will show up in these contexts:
The Id
column of
SHOW COLLATION
output
The ID
column of the
INFORMATION_SCHEMA.COLLATIONS
table
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) |
+---------+
| 210 |
+---------+
For the output just shown, you could choose an ID higher than 210 for the new collation.
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 |
| ... |
| 210 |
+-----+
In this case, you can either choose an unused ID from within the current range of IDs, or choose an ID that is higher than the current maximum ID. For example, in the output just shown, there are unused IDs between 53 and 57, and between 99 and 128. Or you could choose an ID higher than 210.
If you upgrade MySQL, you may find that the collation ID you choose has been assigned to a collation included in the new MySQL distribution. In this case, you will need to choose a new value for your own collation.
In addition, before upgrading, you should save the configuration files that you change. If you upgrade in place, the process will replace the your modified files.
User Comments
Add your own comment.