| Replication & Other Administration issues |
| |
| International Customization ,Character Sets |
| |
| In the default setting of the binary distribution of MySQL (which is included in most Linux distributions), MySQL delivers error messages in English, uses the latin1 character set (ISO-8859-1), and sorts texts according to the Swedish rules. For applications in the English-speaking world this default setting is as it should be. (The peculiarities of the Swedish sorting rules have to do with characters outside of the 7-bit ASCII character set and do not affect the sorting of normal English text.) |
| |
| Error Messages in Other Languages |
| |
| If you wish to have your MySQL server deliver its error messages in a language other than English, say German or French, then you have merely to set the option language in one of the configuration files. The language selected is also used for entries in the error logging file hostname.err. |
| |
| MySQL currently supports about twenty languages. A glance at the directory mysql\share\ (Windows) or /usr/share/mysql (Linux) will tell you their names. If, for example, you find German error messages more to your liking than the English ones, then make the following change in the MySQL configuration file: |
| |
| #in windows\my.ini or /etc/my.cnf
[mysqld]
language = german |
| |
| Selecting the Character Set and Sort Order |
| |
| In MySQL the character set is selected with the option default-character-set, which is set in the MySQL configuration file. If this setting is missing, then the default is latin1 (ISO-8859-1). |
| |
| Which character set is active and which character sets are otherwise available can be determined from the variables character_set and character_sets: |
| |
SHOW VARIABLES LIKE '%char%'
Variable_name Value
-------------------------------------------------------------------------
character_set latin1
character_sets latin1 big5 czech euc_kr gb2312 gbk latin1_de sjis
tis620 ujis dec8 dos german1 hp8 koi8_ru latin2 swe7
usa7 cp1251 danish hebrew win1251 estonia hungarian
koi8_ukr win1251ukr greek win1250 croat cp1257 latin5
convert_character_set
|
| |
| Default Sort Order |
| |
| Just to make matters confusing, with MySQL the choice of character set also influences the sort order. And since MySQL comes from Sweden, with latin1 the sort order is Swedish! Other SQL functions as well that are case-sensitive are influenced by the character set. |
| |
| It is aggravating that the MySQL documentation offers no description of the available character sets. Their names are not always helpful, since they sometimes refer to the characters, sometimes to the sort order, and sometimes to both. (For example, german1 denotes the character set latin1 with German sort order, but latin1_de denotes the character set latin1, this time with the somewhat different German telephone directory order.) |
| |
| Changing the Character Set and Sort Order |
| |
| If youprefer a different sort order, you must change the option default-character-set in the MySQL configuration file (in the following example this is done for the German sort order). You will find a *.conf file for each supported character set in the directory mysql/share/charsets or /usr/share/mysql/charsets. If MySQL cannot find this directory, you must specify the location with the option character-sets-dir. |
| |
#in windows\my.ini or /etc/my.cnf
[mysqld]
character-sets-dir = Q:/mysql/share/charsets
default-character-set = german1
|
| |
| For the settings to become effective, the server must be restarted. |
| |
| |
| |
| |