# Setting the Language for Error Messages

MariaDB server error messages are by default in English. However, MariaDB server also supports error message [localization](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale) in many different languages. Each supported language has its own version of the [error message file](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file) called `errmsg.sys` in a dedicated directory for that language.

## Supported Languages for Error Messages

Error message localization is supported for the following languages:

* Bulgarian
* Chinese (from [MariaDB 10.4.25](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.4/10.4.25), [10.5.16](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.5/10.5.16), [10.6.8](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/10.6/10.6.8), [10.7.4](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.7/10.7.4), [10.8.3](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.8/10.8.3))
* Czech
* Danish
* Dutch
* English
* Estonian
* French
* Georgian (from [MariaDB 10.11.3](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/10.11/10.11.3))
* German
* Greek
* Hindi
* Hungarian
* Italian
* Japanese
* Korean
* Norwegian
* Norwegian-ny (Nynorsk)
* Polish
* Portuguese
* Romanian
* Russian
* Serbian
* Slovak
* Spanish
* Swahili (from [MariaDB 11.1.2](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/11.1/11.1.2))
* Swedish
* Ukrainian

## Setting the `lc_messages` and `lc_messages_dir` System Variables

The [lc\_messages](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages) and [lc\_messages\_dir](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages_dir) system variables can be used to set the [server locale](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale) used for error messages.

The [lc\_messages](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages) system variable can be specified as a [locale](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale) name. The language of the associated [locale](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale) will be used for error messages. See [Server Locales](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale) for a list of supported locales and their associated languages.

The [lc\_messages](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#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](https://github.com/mariadb-corporation/mariadb-docs/blob/main/server/server-usage/replication-cluster-multi-master/optimization-and-tuning/system-variables/server-system-variables.md#lc_messages) system variable is set to a valid [locale](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale) name, but the server can't find an [error message file](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file) for the language associated with the [locale](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale), then the default language will be used instead.

This system variable can be specified as command-line arguments to [mariadbd](https://mariadb.com/docs/server/server-management/starting-and-stopping-mariadb/mariadbd-options) or it can be specified in a relevant server [option group](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files#option-groups) in an [option file](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files). For example:

```ini
[mariadb]
...
lc_messages=fr_CA
```

The [lc\_messages](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages) system variable can also be changed dynamically with [SET GLOBAL](https://mariadb.com/docs/server/sql-statements/administrative-sql-statements/set-commands/set#global-session). For example:

```sql
SET GLOBAL lc_messages='fr_CA';
```

If a server has the [lc\_messages](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages) system variable set to the `fr_CA` locale like the above example, then error messages would be in French. For example:

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

The [lc\_messages\_dir](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages_dir) system variable can be specified either as the path to the directory storing the server's [error message files](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file) or as the path to the directory storing the specific language's [error message file](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file).

The server initially tries to interpret the value of the [lc\_messages\_dir](https://github.com/mariadb-corporation/mariadb-docs/blob/main/server/server-usage/replication-cluster-multi-master/optimization-and-tuning/system-variables/server-system-variables.md#lc_messages_dir) system variable as a path to the directory storing the server's [error message files](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file). Therefore, it constructs the path to the language's [error message file](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file) by concatenating the value of the [lc\_messages\_dir](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages_dir) system variable with the language name of the [locale](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale) specified by the [lc\_messages](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages) system variable .

If the server does not find the [error message file](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file) for the language, then it tries to interpret the value of the [lc\_messages\_dir](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages_dir) system variable as a direct path to the directory storing the specific language's [error message file](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file).

This system variable can be specified as command-line arguments to [mariadbd](https://mariadb.com/docs/server/server-management/starting-and-stopping-mariadb/mariadbd-options) or it can be specified in a relevant server [option group](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files#option-groups) in an [option file](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files).

For example, to specify the path to the directory storing the server's [error message files](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file):

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

Or to specify the path to the directory storing the specific language's [error message file](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file):

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

The [lc\_messages\_dir](https://github.com/mariadb-corporation/mariadb-docs/blob/main/server/server-usage/replication-cluster-multi-master/optimization-and-tuning/system-variables/server-system-variables.md#lc_messages_dir) system variable can not be changed dynamically.

## Setting the --language Option

The [--language](https://mariadb.com/docs/server/server-management/starting-and-stopping-mariadb/mariadbd-options#-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](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#lc_messages) system variable instead.

The [--language](https://mariadb.com/docs/server/server-management/starting-and-stopping-mariadb/mariadbd-options#-language) option can be specified either as a language name or as the path to the directory storing the language's [error message file](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file). See [Server Locales](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale) for a list of supported locales and their associated languages.

This option can be specified as command-line arguments to [mariadbd](https://mariadb.com/docs/server/server-management/starting-and-stopping-mariadb/mariadbd-options) or it can be specified in a relevant server [option group](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files#option-groups) in an [option file](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files).

For example, to specify a language name:

```ini
[mariadb]
...
language=french
```

Or to specify the path to the directory storing the language's [error message file](https://mariadb.com/docs/server/server-management/server-monitoring-logs/error-log#error-messages-file):

```ini
[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](https://mariadb.com/docs/server/server-management/variables-and-modes/server-system-variables#character_set_results) variable, which defaults to UTF8.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/setting-the-language-for-error-messages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
