10bet网址
MySQL 5.7 Reference Manual
Related Documentation Download this Manual Excerpts from this Manual

10.12 Setting the Error Message Language

By default,mysqldproduces error messages in English, but they can be displayed instead in any of several other languages: Czech, Danish, Dutch, Estonian, French, German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Norwegian-ny, Polish, Portuguese, Romanian, Russian, Slovak, Spanish, or Swedish. This applies to messages the server writes to the error log and sends to clients.

To select the language in which the server writes error messages, follow the instructions in this section. For information about changing the character set for error messages (rather than the language), seeSection 10.6, “Error Message Character Set”. For general information about configuring error logging, seeSection 5.4.2, “The Error Log”.

The server searches for the error message file using these rules:

  • It looks for the file in a directory constructed from two system variable values,lc_messages_dirandlc_messages, with the latter converted to a language name. Suppose that you start the server using this command:

    mysqld --lc_messages_dir=/usr/share/mysql --lc_messages=fr_FR

    In this case,mysqldmaps the localefr_FRto the languagefrenchand looks for the error file in the/usr/share/mysql/french目录中。

    By default, the language files are located in theshare/mysql/LANGUAGE导演ry under the MySQL base directory.

  • If the message file cannot be found in the directory constructed as just described, the server ignores thelc_messagesvalue and uses only thelc_messages_dirvalue as the location in which to look.

Thelc_messages_dirsystem variable can be set only at server startup and has only a global read-only value at runtime.lc_messagescan be set at server startup and has global and session values that can be modified at runtime. Thus, the error message language can be changed while the server is running, and each client can have its own error message language by setting its sessionlc_messagesvalue to the desired locale name. For example, if the server is using thefr_FRlocale for error messages, a client can execute this statement to receive error messages in English:

SET lc_messages = 'en_US';