9.2. Setting the Error Message Language

By default, mysqld produces error messages in English, but they can also be displayed 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.

You can select which language the server uses for error messages using the instructions in this section.

As of MySQL 5.5, the server searches for the error message file in two locations:

  • It tries to find the file in a directory constructed from two parts, the value of --lc-messages-dir and the value of --lc-messages converted to a language name. Suppose that you start the server using this command:

    shell> mysqld --lc-messages-dir=/usr/share/mysql --lc-messages=fr_FR
    

    In this case, mysqld maps the locale fr_FR to the language french and looks for the error file in the /usr/share/mysql/french directory.

  • If the message file cannot be found in the directory constructed as just described, the server ignores the --lc-messages value and uses only the --lc-messages-dir value as the location in which to look.

The --lc-messages-dir and --lc-messages options are accompanied by the lc_messages_dir and lc_messages system variables. lc_messages_dir has only a global value and is read only. lc_messages has global and session values and can be modified at runtime, so the error message language can be changed while the server is running, and individual clients each can have a different error message language by changing their session lc_messages value to a different locale name. For example, if the server is using the fr_FR locale for error messages, a client that wants error messages in English can execute this statement:

mysql> SET lc_messages = 'en_US';

Before MySQL 5.5, the --lc-messages-dir and --lc-messages options (and accompanying system variables) were unavailable. To start mysqld with a particular language for error messages, the --language or -L option were used. The option value can be a language name or the full path to the error message file. For example:

shell> mysqld --language=swedish

Or:

shell> mysqld --language=/usr/local/share/swedish

The language name should be specified in lowercase.

From MySQL 5.5 on, --language is treated as an alias for --lc-messages-dir.

By default, the language files are located in the share/mysql/LANGUAGE directory under the MySQL base directory.

For information about changing the character set for error messages (rather than the language), see Section 9.1.6, “Character Set for Error Messages”.

You can change the content of the error messages produced by the server using the instructions in the MySQL Internals manual, available at http://forge.mysql.com/wiki/MySQL_Internals_Error_Messages. If you do change the content of error messages, remember to repeat your changes after each upgrade to a newer version of MySQL.

Copyright © 2010-2024 Platon Technologies, s.r.o.           Index | Man stránky | tLDP | Dokumenty | Utilitky | O projekte
Design by styleshout