W3cubDocs

/MariaDB

Setting the Language for Error Messages

MariaDB server error messages are by default in English. However, MariaDB server also supports error message localization in many different languages. Each supported language has its own version of the error message file called errmsg.sys in a dedicated directory for that language.

Supported Languages for Error Messages

MariaDB starting with 10.2

In MariaDB 10.2 and later, error message localization is supported for the following languages:

  • Czech
  • Danish
  • Dutch
  • English
  • Estonian
  • French
  • German
  • Greek
  • Hindi
  • Hungarian
  • Italian
  • Japanese
  • Korean
  • Norwegian
  • Norwegian-ny (Nynorsk)
  • Polish
  • Portuguese
  • Romanian
  • Russian
  • Serbian
  • Slovak
  • Spanish
  • Swedish
  • Ukrainian
MariaDB until 10.1

In MariaDB 10.1 and before, error message localization is supported for the following languages:

  • Czech
  • Danish
  • Dutch
  • English
  • Estonian
  • French
  • German
  • Greek
  • Hungarian
  • Italian
  • Japanese
  • Korean
  • Norwegian
  • Norwegian-ny (Nynorsk)
  • Polish
  • Portuguese
  • Romanian
  • Russian
  • Serbian
  • Slovak
  • Spanish
  • Swedish
  • Ukrainian

Setting the lc_messages and lc_messages_dir System Variables

The lc_messages and lc_messages_dir system variables can be used to set the server locale used for error messages.

The lc_messages system variable can be specified as a locale name. The language of the associated locale will be used for error messages. See Server Locales for a list of supported locales and their associated languages.

The lc_messages system variable is set to en_US by default, which means that error messages are in English by default.

If the lc_messages system variable is set to a valid locale name, but the server can't find an error message file for the language associated with the locale, then the default language will be used instead.

This system variable can be specified as command-line arguments to mysqld or it can be specified in a relevant server option group in an option file. For example:

[mariadb]
...
lc_messages=fr_CA

The lc_messages system variable can also be changed dynamically with SET GLOBAL. For example:

SET GLOBAL lc_messages='fr_CA';

If a server has the lc_messages system variable set to the fr_CA locale like the above example, then error messages would be in French. For example:

SELECT blah;
ERROR 1054 (42S22): Champ 'blah' inconnu dans field list

The lc_messages_dir system variable can be specified either as the path to the directory storing the server's error message files or as the path to the directory storing the specific language's error message file.

The server initially tries to interpret the value of the lc_messages_dir system variable as a path to the directory storing the server's error message files. Therefore, it constructs the path to the language's error message file by concatenating the value of the lc_messages_dir system variable with the language name of the locale specified by the lc_messages system variable .

If the server does not find the error message file for the language, then it tries to interpret the value of the lc_messages_dir system variable as a direct path to the directory storing the specific language's error message file.

This system variable can be specified as command-line arguments to mysqld or it can be specified in a relevant server option group in an option file.

For example, to specify the path to the directory storing the server's error message files:

[mariadb]
...
lc_messages_dir=/usr/share/mysql/

Or to specify the path to the directory storing the specific language's error message file:

[mariadb]
...
lc_messages_dir=/usr/share/mysql/french/

The lc_messages_dir system variable can not be changed dynamically.

Setting the --language Option

The --language option can also be used to set the server's language for error messages, but it is deprecated. It is recommended to set the lc_messages system variable instead.

The --language option can be specified either as a language name or as the path to the directory storing the language's error message file. See Server Locales for a list of supported locales and their associated languages.

This option can be specified as command-line arguments to mysqld or it can be specified in a relevant server option group in an option file.

For example, to specify a language name:

[mariadb]
...
language=french

Or to specify the path to the directory storing the language's error message file:

[mariadb]
...
language=/usr/share/mysql/french/

Character Set

The character set that the error messages are returned in is determined by the character_set_results variable, which defaults to UTF8.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/setting-the-language-for-error-messages/