All pages
Powered by GitBook
1 of 6

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Internationalization and Localization

Discover how MariaDB supports internationalization and localization, enabling databases to store and process data in multiple languages.

Coordinated Universal Time

Coordinated Universal Time (UTC) is the primary time standard by which the world regulates clocks and time, and is the internal storage format for MariaDB timestamp values.

UTC stands for Coordinated Universal Time. It is the world standard for regulating time.

MariaDB stores values internally in UTC, converting them to the required time zone as required.

In general terms it is equivalent to Greenwich Mean Time (GMT), but UTC is used in technical contexts, as it is precisely defined at the subsecond level.

Time zones are offset relative to UTC. For example, time in Tonga is UTC + 13, so 03h00 UTC is 16h00 in Tonga.

See Also

This page is licensed: CC BY-SA / Gnu FDL

UTC_DATE
UTC_TIME
UTC_TIMESTAMP

Setting the Language for Error Messages

Learn how to configure the lc_messages and lc_messages_dir system variables to display server error messages in a supported local language.

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

Error message localization is supported for the following languages:

  • Bulgarian

  • Chinese (from , , , , )

  • Czech

  • Danish

  • Dutch

  • English

  • Estonian

  • French

  • Georgian (from )

  • German

  • Greek

  • Hindi

  • Hungarian

  • Italian

  • Japanese

  • Korean

  • Norwegian

  • Norwegian-ny (Nynorsk)

  • Polish

  • Portuguese

  • Romanian

  • Russian

  • Serbian

  • Slovak

  • Spanish

  • Swahili (from )

  • Swedish

  • Ukrainian

Setting the lc_messages and lc_messages_dir System Variables

The and system variables can be used to set the used for error messages.

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

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

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

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

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

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

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

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

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

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

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

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

The system variable can not be changed dynamically.

Setting the --language Option

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

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

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

For example, to specify a language name:

Or to specify the path to the directory storing the language's :

Character Set

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

This page is licensed: CC BY-SA / Gnu FDL

Locales Plugin

The LOCALES plugin enables the INFORMATION_SCHEMA.LOCALES table and SHOW LOCALES statement, allowing users to view all locales compiled into the server.

The LOCALES plugin creates the table in the database. The plugin also adds the statement.The table and statement can be queried to see all that are compiled into the server.

Installing the Plugin

Although the plugin's shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.

The first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing

or
. For example:

The second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file. For example:

Uninstalling the Plugin

You can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN. For example:

If you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.

Example

Options

locales

  • Description: Controls how the server should treat the plugin when the server starts up.

    • Valid values are:

      • OFF - Disables the plugin without removing it from the mysql.plugins table.

      • ON - Enables the plugin. If the plugin cannot be initialized, then the server still continues starting up, but the plugin will be disabled.

      • FORCE - Enables the plugin. If the plugin cannot be initialized, then the server fails to start with an error.

      • FORCE_PLUS_PERMANENT - Enables the plugin. If the plugin cannot be initialized, then the server fails to start with an error. In addition, the plugin cannot be uninstalled with or while the server is running.

    • See for more information.

  • Command line: --locales=value

  • Data Type: enumerated

  • Default Value: ON

  • Valid Values: OFF, ON, FORCE, FORCE_PLUS_PERMANENT

This page is licensed: CC BY-SA / Gnu FDL

LOCALES
INFORMATION_SCHEMA
SHOW LOCALES
locales
INSTALL SONAME
INSTALL PLUGIN
10.6.8
MariaDB 10.11.3
lc_messages
lc_messages_dir
server locale
lc_messages
locale
locale
Server Locales
lc_messages
lc_messages
locale
error message file
locale
mariadbd
option group
option file
lc_messages
SET GLOBAL
lc_messages
lc_messages_dir
error message files
error message file
lc_messages_dir
error message files
error message file
lc_messages_dir
locale
lc_messages
error message file
lc_messages_dir
error message file
mariadbd
option group
option file
error message files
error message file
lc_messages_dir
--language
lc_messages
--language
error message file
Server Locales
mariadbd
option group
option file
error message file
character_set_results
INSTALL SONAME 'locales';
[mariadb]
...
plugin_load_add = locales
UNINSTALL SONAME 'locales';
SELECT * FROM INFORMATION_SCHEMA.LOCALES;
+-----+-------+-------------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+
| ID  | NAME  | DESCRIPTION                         | MAX_MONTH_NAME_LENGTH | MAX_DAY_NAME_LENGTH | DECIMAL_POINT | THOUSAND_SEP | ERROR_MESSAGE_LANGUAGE |
+-----+-------+-------------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+
|   0 | en_US | English - United States             |                     9 |                   9 | .             | ,            | english                |
|   1 | en_GB | English - United Kingdom            |                     9 |                   9 | .             | ,            | english                |
|   2 | ja_JP | Japanese - Japan                    |                     3 |                   3 | .             | ,            | japanese               |
|   3 | sv_SE | Swedish - Sweden                    |                     9 |                   7 | ,             |              | swedish                |
|   4 | de_DE | German - Germany                    |                     9 |                  10 | ,             | .            | german                 |
|   5 | fr_FR | French - France                     |                     9 |                   8 | ,             |              | french                 |
|   6 | ar_AE | Arabic - United Arab Emirates       |                     6 |                   8 | .             | ,            | english                |
|   7 | ar_BH | Arabic - Bahrain                    |                     6 |                   8 | .             | ,            | english                |
|   8 | ar_JO | Arabic - Jordan                     |                    12 |                   8 | .             | ,            | english                |
...
| 106 | no_NO | Norwegian - Norway                  |                     9 |                   7 | ,             | .            | norwegian              |
| 107 | sv_FI | Swedish - Finland                   |                     9 |                   7 | ,             |              | swedish                |
| 108 | zh_HK | Chinese - Hong Kong SAR             |                     3 |                   3 | .             | ,            | english                |
| 109 | el_GR | Greek - Greece                      |                    11 |                   9 | ,             | .            | greek                  |
| 110 | rm_CH | Romansh - Switzerland               |                     9 |                   9 | ,             | .            | english                |
+-----+-------+-------------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+
[mariadb]
...
lc_messages=fr_CA
SET GLOBAL lc_messages='fr_CA';
SELECT blah;
ERROR 1054 (42S22): Champ 'blah' inconnu dans field list
[mariadb]
...
lc_messages_dir=/usr/share/mysql/
[mariadb]
...
lc_messages_dir=/usr/share/mysql/french/
[mariadb]
...
language=french
[mariadb]
...
language=/usr/share/mysql/french/
UNINSTALL SONAME
UNINSTALL PLUGIN
Plugin Overview: Configuring Plugin Activation at Server Startup

Time Zones

Manage time zone settings in MariaDB, including the global server time zone, session time zone, and system time zone configurations.

MariaDB keeps track of several time zone settings.

Setting the Time Zone

The time_zone system variable is the primary way to set the time zone. It can be specified in one of the following formats:

  • The default value is SYSTEM, which indicates that the system time zone defined in the system variable will be used. Note that if you are using SYSTEM with replication in either statement or mixed mode, you MUST use the same value for system_time_zone on all replicas (otherwise TIMESTAMP columns will not replicate correctly). See below for more information.

  • An offset from , such as +5:00 or -9:00, can also be used.

  • If the time zone tables in the database were loaded, then a named time zone, such as America/New_York, Africa/Johannesburg, or Europe/Helsinki, is also permissible. See below for more information.

There are two time zone settings that can be set within MariaDB--the global server time zone, and the time zone for your current session. There is also a third time zone setting which may be relevant--the system time zone.

Global Server Time Zone

The global server time zone can be changed at server startup by setting the --default-time-zone option either on the command-line or in a server in an . For example:

The global server time zone can also be changed dynamically by setting the system variable as a user account that has the privilege. For example:

The current global server time zone can be viewed by looking at the global value of the system variable. For example:

Session Time Zone

Each session that connects to the server will also have its own time zone. This time zone is initially inherited from the global value of the system variable, which sets the session value of the same variable.

A session's time zone can be changed dynamically by setting the system variable. For example:

The current session time zone can be viewed by looking at the session value of the system variable. For example:

System Time Zone

The system time zone is determined when the server starts, and it sets the value of the system variable. The system time zone is usually read from the operating system's environment. You can change the system time zone in several different ways, such as:

  • If you are starting the server with , then you can set the system time zone with the --timezone option either on the command-line or in the [mariadbd-safe] in an . For example:

  • If you are using a Unix-like operating system, then you can set the system time zone by setting the TZ in your shell before starting the server. For example:

  • On some Linux operating systems, you can change the default time zone for the whole system by making the symbolic link point to the desired time zone. For example:

  • On some Debian-based Linux operating systems, you can change the default time zone for the whole system by executing the following:

  • On Linux operating systems that use , you can change the default time zone for the whole system by using the utility. For example:

Time Zone Effects

Time Zone Effects on Functions

Some functions are affected by the time zone settings. These include:

Some functions are not affected. These include:

Time Zone Effects on Data Types

Some data types are affected by the time zone settings.

  • - See for information on how this data type is affected by time zones.

  • - See for information on how this data type is affected by time zones.

mysql Time Zone Tables

The database contains a number of time zone tables:

By default, these time zone tables in the database are created, but not populated.

If you are using a Unix-like operating system, then you can populate these tables using the utility, which uses the data available on Linux, Mac OS X, FreeBSD and Solaris.

If you are using Windows, then you will need to import pre-populated time zone tables. These are available at .

Time zone data needs to be updated on occasion. When that happens, the time zone tables may need to be reloaded.

See Also

  • (video)

This page is licensed: CC BY-SA / Gnu FDL

UNIX_TIMESTAMP()
time_zone_transition_type
system_time_zone
System Time Zone
Coordinated Universal Time (UTC)
mysql
mysql Time Zone Tables
option group
option file
time_zone
SUPER
time_zone
time_zone
time_zone
time_zone
system_time_zone
mariadbd-safe
option group
option file
environment variable
/etc/localtime
systemd
timedatectl
NOW()
SYSDATE()
CURDATE()
CURTIME()
UTC_DATE()
UTC_TIME()
UTC_TIMESTAMP()
TIMESTAMP
TIMESTAMP: Time Zones
DATETIME
DATETIME: Time Zones
mysql
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
mysql
mariadb-tzinfo-to-sql
zoneinfo
MariaDB mirrors
LinuxJedi in Spacetime: Properly Handling Time and Date
[mariadb]
...
default_time_zone = 'America/New_York'
SET GLOBAL time_zone = 'America/New_York';
SHOW GLOBAL VARIABLES LIKE 'time_zone';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| time_zone     | SYSTEM |
+---------------+--------+
SET time_zone = 'America/New_York';
SHOW SESSION VARIABLES LIKE 'time_zone';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| time_zone     | SYSTEM |
+---------------+--------+
[mariadbd-safe]
timezone='America/New_York'
$ export TZ='America/New_York'
$ service mariadb start
$ sudo rm /etc/localtime
$ sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
sudo dpkg-reconfigure tzdata
sudo timedatectl set-timezone America/New_York

Server Locale

Server locale settings control the language for date and time functions via lc_time_names and the language for error messages via lc_messages.

The lc_time_names server system variable sets the language used by the date and time functions DAYNAME(), MONTHNAME(), and DATE_FORMAT(), and the lc_messages sets the language for error messages.

The list of the locales supported by the current MariaDB installation can be obtained via the LOCALES plugin.

MariaDB supports the following locale values:

Locale
Language
Territory

ar_AE

Arabic

United Arab Emirates

Examples

Setting the and variables to localize the units of date and time, and the server error messages.

This page is licensed: CC BY-SA / Gnu FDL

ar_BH

Arabic

Bahrain

ar_DZ

Arabic

Algeria

ar_EG

Arabic

Egypt

ar_IN

Arabic

Iran

ar_IQ

Arabic

Iraq

ar_JO

Arabic

Jordan

ar_KW

Arabic

Kuwait

ar_LB

Arabic

Lebanon

ar_LY

Arabic

Libya

ar_MA

Arabic

Morocco

ar_OM

Arabic

Oman

ar_QA

Arabic

Qatar

ar_SA

Arabic

Saudi Arabia

ar_SD

Arabic

Sudan

ar_SY

Arabic

Syria

ar_TN

Arabic

Tunisia

ar_YE

Arabic

Yemen

be_BY

Belarusian

Belarus

bg_BG

Bulgarian

Bulgaria

ca_ES

Catalan

Catalan

cs_CZ

Czech

Czech Republic

da_DK

Danish

Denmark

de_AT

German

Austria

de_BE

German

Belgium

de_CH

German

Switzerland

de_DE

German

Germany

de_LU

German

Luxembourg

el_GR

Greek

Greece

en_AU

English

Australia

en_CA

English

Canada

en_GB

English

United Kingdom

en_IN

English

India

en_NZ

English

New Zealand

en_PH

English

Philippines

en_US

English

United States

en_ZA

English

South Africa

en_ZW

English

Zimbabwe

es_AR

Spanish

Argentina

es_BO

Spanish

Bolivia

es_CL

Spanish

Chile

es_CO

Spanish

Columbia

es_CR

Spanish

Costa Rica

es_DO

Spanish

Dominican Republic

es_EC

Spanish

Ecuador

es_ES

Spanish

Spain

es_GT

Spanish

Guatemala

es_HN

Spanish

Honduras

es_MX

Spanish

Mexico

es_NI

Spanish

Nicaragua

es_PA

Spanish

Panama

es_PE

Spanish

Peru

es_PR

Spanish

Puerto Rico

es_PY

Spanish

Paraguay

es_SV

Spanish

El Salvador

es_US

Spanish

United States

es_UY

Spanish

Uruguay

es_VE

Spanish

Venezuela

et_EE

Estonian

Estonia

eu_ES

Basque

Basque

fi_FI

Finnish

Finland

fo_FO

Faroese

Faroe Islands

fr_BE

French

Belgium

fr_CA

French

Canada

fr_CH

French

Switzerland

fr_FR

French

France

fr_LU

French

Luxembourg

gl_ES

Galician

Galician

gu_IN

Gujarati

India

he_IL

Hebrew

Israel

hi_IN

Hindi

India

hr_HR

Croatian

Croatia

hu_HU

Hungarian

Hungary

id_ID

Indonesian

Indonesia

is_IS

Icelandic

Iceland

it_CH

Italian

Switzerland

it_IT

Italian

Italy

ja_JP

Japanese

Japan

ka_GE

Georgian

Georgia (From )

ko_KR

Korean

Republic of Korea

lt_LT

Lithuanian

Lithuania

lv_LV

Latvian

Latvia

mk_MK

Macedonian

FYROM

mn_MN

Mongolia

Mongolian

ms_MY

Malay

Malaysia

nb_NO

Norwegian(Bokmål)

Norway

nl_BE

Dutch

Belgium

nl_NL

Dutch

The Netherlands

no_NO

Norwegian

Norway

pl_PL

Polish

Poland

pt_BR

Portugese

Brazil

pt_PT

Portugese

Portugal

rm_CH

Romansh

Switzerland

ro_RO

Romanian

Romania

ru_RU

Russian

Russia

ru_UA

Russian

Ukraine

sk_SK

Slovak

Slovakia

sl_SI

Slovenian

Slovenia

sq_AL

Albanian

Albania

sr_YU

Serbian

Serbia (Deprecated in and removed in )

sv_FI

Swedish

Finland

sv_SE

Swedish

Sweden

sw_KE

Swahili

Kenya (from )

ta_IN

Tamil

India

te_IN

Telugu

India

th_TH

Thai

Thailand

tr_TR

Turkish

Turkey

uk_UA

Ukrainian

Ukraine

ur_PK

Urdu

Pakistan

vi_VN

Vietnamese

Viet Nam

zh_CN

Chinese

China

zh_HK

Chinese

Hong Kong

zh_TW

Chinese

Taiwan Province of China

lc_time_names
lc_messages
SELECT DAYNAME('2013-04-01'), MONTHNAME('2013-04-01');
+-----------------------+-------------------------+
| DAYNAME('2013-04-01') | MONTHNAME('2013-04-01') |
+-----------------------+-------------------------+
| Monday                | April                   |
+-----------------------+-------------------------+

SET lc_time_names = 'fr_CA';

SELECT DAYNAME('2013-04-01'), MONTHNAME('2013-04-01');
+-----------------------+-------------------------+
| DAYNAME('2013-04-01') | MONTHNAME('2013-04-01') |
+-----------------------+-------------------------+
| lundi                 | avril                   |
+-----------------------+-------------------------+

SELECT blah;
ERROR 1054 (42S22): Unknown column 'blah' in 'field' list'

SET lc_messages = 'nl_NL';

SELECT blah;
ERROR 1054 (42S22): Onbekende kolom 'blah' in field list
MariaDB 10.4.25
10.5.16
10.7.4
10.8.3
MariaDB 11.1.2
MariaDB 10.11.3
MariaDB 10.0.11
MariaDB 10.3.0
MariaDB 11.1.2