How to Fix MySQL Error 3778 (ER_WARN_DEPRECATED_UTF8MB3_COLLATION)
You see mysql error 3778 when a query or table uses an old UTF8MB3 collation. To fix it, change your database tables, columns, and client sessions to use UTF8MB4 collations. MySQL logs this issue with the symbol ER_WARN_DEPRECATED_UTF8MB3_COLLATION and the SQLSTATE code HY000. The message warns that your chosen collation belongs to the deprecated UTF8MB3 character set. It asks you to use UTF8MB4 with an appropriate collation instead. While this starts as a warning, strict modes in apps can trea
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 3778 when a query or table uses an old UTF8MB3 collation. To fix it, change your database tables, columns, and client sessions to use UTF8MB4 collations.
MySQL logs this issue with the symbol ER_WARN_DEPRECATED_UTF8MB3_COLLATION and the SQLSTATE code HY000. The message warns that your chosen collation belongs to the deprecated UTF8MB3 character set. It asks you to use UTF8MB4 with an appropriate collation instead. While this starts as a warning, strict modes in apps can treat it as a failure.
What causes mysql error 3778 in your database
Older MySQL setups used a three-byte format for UTF-8 text. That older format is now called UTF8MB3. It cannot store four-byte characters like emojis or certain math symbols. Modern MySQL engines want all systems to use the full four-byte UTF8MB4 format instead.
This error triggers when the server processes a collation linked to UTF8MB3. You might see it when you run a schema migration or create a new table. It also appears when an app sends a collation rule during the initial database handshake. Even legacy stored procedures or views can trigger the warning when they run.
Database upgrades often expose this issue across many services at once. Your old tables keep their legacy collation rules after the engine upgrade finishes. Every time a query touches those tables or sets a legacy session rule, MySQL logs 3778. If your app treats warnings as errors, your queries will stop working.
How to find and fix the collation warning in production
Start by checking where the legacy collation lives in your system. Inspect the metadata catalog to see which schemas, tables, and text columns still reference UTF8MB3. Do not grant broad admin rights to developers just to check these table settings. Use a read-only role to query the system catalog views and list every affected object.
Next, check how your apps talk to the database. Many client drivers set a character set and collation as soon as they log in. If the app config asks for the old three-byte format, the server returns error 3778. Update the client connection settings in your app to request a four-byte UTF8MB4 collation.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
When you are ready to fix the tables, plan the schema changes with care. Changing a column collation rewrites the table data and rebuilds the text indexes. On a large production table, this lock can block live traffic. Run these schema updates through a controlled migration tool during low traffic hours.
Check your index size limits before you alter any columns. Four-byte characters take up more space in indexes than three-byte characters. Make sure your indexed text columns fit within the storage engine row limits before you run the change. Test the new collation in a staging setup to verify that sorting and text searches match your app rules.
How to prevent legacy collation drift across teams
Once you clean up your tables, stop new legacy collations from entering production. Set the default server character set and collation to UTF8MB4 in your database config. This ensures that new tables without explicit rules use the four-byte format right away.
Review all SQL migration files before they run against your production cluster. Developers often copy old table templates that still include deprecated collation names. Catching these strings during peer review keeps your logs clean and prevents surprise app failures.
Add wire guardrails and masking beside MySQL
Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev sits inline in the wire protocol beside the database as a sidecar for your MySQL. On every production query an agent or engineer sends, hoop.dev decides to pass, mask, block, or escalate it for human review.
With hoop.dev MySQL support, guardrails refuse bad queries before they run or hold risky calls for approval, while data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.
Frequently asked questions
Does mysql error 3778 stop my queries from running?
By default, code 3778 is a warning and the query still runs. Still, if your app or migration tool rejects database warnings, the operation will fail.
Will changing from UTF8MB3 to UTF8MB4 corrupt my existing text data?
No, every valid three-byte character is also valid in the four-byte UTF8MB4 format. Still, test the change in staging first because new collation rules can alter sort order.
Why do I see error 3778 after upgrading my database tables?
Your app driver or session setup might still request a UTF8MB3 collation when it logs in. Check your client config files and update the connection settings to use UTF8MB4.
Related guides
In this post