Common SQL Errors

MySQL Error 1649 ER_UNKNOWN_LOCALE: Unknown locale - How to Fix and Prevent

Galaxy Team
August 7, 2025

<p>The server cannot recognize the specified locale string in a SET NAMES or SET LC_TIME_NAMES statement.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1649 ER_UNKNOWN_LOCALE?

<p>MySQL Error 1649 ER_UNKNOWN_LOCALE occurs when the server cannot find a locale such as en_US or fr_FR specified in SET commands. Confirm that the locale is compiled into MySQL or provide a valid alternative. Correcting the locale name or rebuilding the server with the desired locale resolves the error.</p>

Error Highlights

Typical Error Message

Unknown locale: '%s'

Error Type

Configuration Error

Language

MySQL

Symbol

ER_UNKNOWN_LOCALE

Error Code

1649

SQL State

HY000

Explanation

Table of Contents

What is MySQL Error 1649 ER_UNKNOWN_LOCALE?

Error 1649 fires when MySQL receives a locale identifier it does not recognize. The message Unknown locale: '%s' tells you that the server could not locate the requested language-country combination in its compiled locale table.

The problem usually appears during SET NAMES, SET COLLATION_CONNECTION, or SET LC_TIME_NAMES statements that reference non-existent locales. It can also surface during server startup if the collation_server or character_set_server variables contain an unsupported locale tag.

What Causes This Error?

An unsupported locale string such as es_MX_utf8mb4 is the most common cause. Older MySQL builds hard-code a limited locale list, so new regional codes fail.

Mis-typed locale names, missing language packs in custom builds, or stripped locales in container images also generate the error.

How to Fix MySQL Error 1649 ER_UNKNOWN_LOCALE

First, verify the locale name with SHOW LOCALES or the MySQL manual. Replace invalid values in SET or system variable statements with a supported tag like en_US.

If the locale is valid but absent from the server, rebuild MySQL with the desired locale enabled or upgrade to a distribution that already includes it.

Common Scenarios and Solutions

Application frameworks often issue SET NAMES 'utf8mb4' COLLATE 'en_US'. Change the collate clause to utf8mb4_general_ci.

Docker images trimmed for size may omit locale data. Use a full MySQL image or add required locales at build time.

Best Practices to Avoid This Error

Always test SET statements in staging to confirm locale availability. Pin your MySQL version and document supported locale tags for developers.

When using Galaxy, shared queries are centrally versioned, so invalid locale settings can be caught in code review before they hit production.

Related Errors and Solutions

Error 1115 Unknown character set arises when the charset portion of a locale is wrong. Use SHOW CHARACTER SET to validate.

Error 1267 Illegal mix of collations appears when two columns with incompatible collations are compared. Align them using ALTER TABLE ... CONVERT TO CHARACTER SET.

Common Causes

Unsupported regional code

The locale string is not compiled into the MySQL build, e.g., en_GB when only en_US exists.

Typographical error

Developers accidentally type de_DEE instead of de_DE, leading to an unknown tag.

Minimal container image

Alpine or slim images exclude locale data to reduce size, so standard locales are missing.

Custom build without language packs

Compiling MySQL from source without specifying all locales limits availability at runtime.

Related Errors

MySQL Error 1115 Unknown character set

Occurs when the specified charset does not exist. Solution: install or select a valid charset.

MySQL Error 1267 Illegal mix of collations

Triggered when comparing strings of different collations. Solution: align collations or use COLLATE clause.

MySQL Error 1253 COLLATION 'xyz' is not valid

Raised when an undefined collation is referenced. Solution: choose a supported collation.

FAQs

How do I know which locales MySQL supports?

Use SHOW VARIABLES LIKE 'lc_%' or consult the MySQL documentation for your exact version.

Can I add new locales without recompiling MySQL?

Official binaries are fixed. To add locales you must install a distribution that already includes them or rebuild from source.

Why does the error only appear in Docker?

Slim Docker images often strip locale data. Use a full image or add the required packages during build.

How does Galaxy help catch this error?

Galaxy stores shared queries, so invalid SET statements are reviewed centrally, reducing production incidents.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo