How to Fix MySQL Error 1273 (ER_UNKNOWN_COLLATION)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see mysql error 1273 when the database server does not know a requested collation. To fix it, change the collation name to one that your target server supports. This failure uses the symbol ER_UNKNOWN_COLLATION and returns SQLSTATE HY000. The server stops the query and outputs the unknown collation message. Teams hit this error most often when moving data between two different database servers. It also happens when an app sends a connection setting that the server lacks. What causes mysql

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You see mysql error 1273 when the database server does not know a requested collation. To fix it, change the collation name to one that your target server supports.

This failure uses the symbol ER_UNKNOWN_COLLATION and returns SQLSTATE HY000. The server stops the query and outputs the unknown collation message. Teams hit this error most often when moving data between two different database servers. It also happens when an app sends a connection setting that the server lacks.

What causes mysql error 1273 in your database

A collation is a rule set that tells the database how to sort text. It also controls how the engine compares letters, accents, and character cases. Newer database releases add fresh collations to handle modern text standards and emojis. Older releases or different database forks do not have these newer rule sets.

When you export a backup from a new server, the dump file records those modern collations. If you import that file into an older server, the engine reads the unknown name. The target server checks its internal list of valid collations and finds no match. It halts the import right away and throws ER_UNKNOWN_COLLATION.

Client tools and app drivers can also trigger this problem during the initial handshake. A newer driver might ask for a modern default collation when it opens a session. If the database server runs an older build, it rejects the session setup. Replication links fail the same way when a source node uses a newer collation than the replica.

How to find and fix the collation mismatch

First, read the exact error message in your log to see the failing collation name. The server prints the unknown string inside single quotes at the end of the message. Next, check the supported collations on your target database server. You can query the server catalog to list all valid character sets and collations.

Once you find a valid match on the target server, you have two ways forward. The cleanest fix is to upgrade the target database so it supports the newer collation. This keeps your text sorting rules identical across every server in your fleet. Still, upgrading a live database takes planning and is not always fast.

MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If you cannot upgrade the server, you must change the collation before loading the data. Ideally, re-run the export from the source database and set a compatible character set. If you only have the backup file, replace the unknown collation name with a supported one. Make sure the new collation uses the same base character set so text stays intact.

How to prevent collation errors across teams

Database errors during a deployment often force engineers to ask for broad server roles. Giving out direct admin keys to edit dump files or server settings creates risk. People make mistakes when rushing to fix a broken restore in a live setup. Someone might pick a mismatched collation that corrupts special characters or breaks text indexes.

Standardize your database builds across local, staging, and live tiers to stop this drift. When every tier runs the exact same engine release, collation mismatches disappear. You should also set clear rules for which character sets new tables can use. Reviewing schema changes before they run helps your team catch bad collations early.

Finally, restrict how engineers run ad-hoc fixes against live databases. Use a central control layer that checks queries and logs every action by identity. Masking rules can also rewrite sensitive fields like emails or card numbers in query results. This lets your team check character sets and fix errors while keeping private data safe.

Inspect every MySQL query and response in flight

Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.

First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.

Frequently asked questions

Does changing a collation delete or corrupt my existing table data?

Changing a collation stays safe if you keep the same underlying character set. Moving from a four-byte character set to a three-byte one can cut off emojis.

Why does mysql error 1273 happen when moving data to MariaDB?

Both database engines took different paths and built their own collations over time. You must map engine-specific collation names to standard ones before you import the file.

Can a client app trigger ER_UNKNOWN_COLLATION without running a table import?

Yes, an updated database driver may request a new collation when it logs in. Set the client connection settings to use a collation that your older server knows.

The query runs. The emails stay hidden.