Fix: “Unknown table ‘locales’ in information_schema” in MariaDB

If you get the Unknown table 'locales' in information_schema error in MariaDB, it’s probably because you haven’t installed the LOCALES plugin yet.

You need to install the LOCALES plugin before you try to query this table.

The Error

Here’s an example of the error.

SELECT * FROM INFORMATION_SCHEMA.LOCALES;

Result:

ERROR 1109 (42S02): Unknown table 'locales' in information_schema

The error is self-explanatory. There’s no table of that name. We tried to query a table that doesn’t exist.

The Solution

You need to create the INFORMATION_SCHEMA.LOCALES table and populate it with the locales.

Fortunately, there’s a plugin called LOCALES that does just that:

INSTALL SONAME 'locales';

You can alternatively use the INSTALL PLUGIN syntax.

It’s also possible to install this plugin when the server starts up. You can do this by passing the --plugin-load or the --plugin-load-add command-line arguments to mysqld, or providing them in the relevant server option group in an option file.

Once the plugin has been installed, the INFORMATION_SCHEMA.LOCALES table can be queried.

Example:

SELECT * 
FROM INFORMATION_SCHEMA.LOCALES
LIMIT 10;

Result:

+----+-------+-------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+
| 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                |
|  9 | ar_SA | Arabic - Saudi Arabia         |                    12 |                   8 | .             |              | english                |
+----+-------+-------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+