How to Fix MySQL Error 3720 (ER_DEPRECATED_NATIONAL)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get mysql error 3720 when queries use old national character data types. Fix it by replacing those types with standard text columns and four-byte UTF-8. Database teams often see this warning during upgrades or schema changes. The engine maps the ER_DEPRECATED_NATIONAL symbol to the general SQL state HY000. It warns you that national text types rely on an old character set. That three-byte set is going away in future versions. Updating your schema now prevents broken queries and character lo

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 get mysql error 3720 when queries use old national character data types. Fix it by replacing those types with standard text columns and four-byte UTF-8.

Database teams often see this warning during upgrades or schema changes. The engine maps the ER_DEPRECATED_NATIONAL symbol to the general SQL state HY000. It warns you that national text types rely on an old character set. That three-byte set is going away in future versions. Updating your schema now prevents broken queries and character loss down the road.

Why mysql error 3720 happens in your database

The database triggers mysql error 3720 when a query uses national character types. These old types point to a legacy three-byte character set by default. That old set cannot store four-byte characters like modern symbols or emojis. The database team plans to replace the three-byte set with the four-byte set.

You will see this message when running old migration scripts in your app. Object-relational mappers can also send these deprecated types if they use old rules. Cross-database migration tools often create national text columns when moving tables from other systems. The server catches these keywords and writes a warning to the log. If your client treats warnings as strict errors, the whole job will fail.

How to find and fix the warning in production

Start by checking your query logs and schema files for national character keywords. Check the information schema tables to find columns still using the three-byte set. Look at your app code and migration tools to see what sends them. Search for any table creation rules that ask for national text types.

Do not give developers broad admin rights on production to hunt for this issue. Instead, run a read-only check on the table metadata with a limited role. Once you find the old definitions, update your migration files in source control. Change national text types to standard character types with an explicit four-byte set. Test the change on a staging copy to check index sizes first.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Four-byte characters take up more space in indexes than three-byte characters do. Make sure your index keys stay under the storage engine size limit. After testing, run the schema update during a safe maintenance window. You should also keep data safety rules active while teams inspect column data. For example, masking rewrites matched fields like emails and phone numbers in query results.

How to prevent character set issues during team changes

Set your database server default character set to the modern four-byte format. Update your app client settings so every session asks for four-byte text. Review third-party tools and reporting scripts to make sure they use standard types. Add a check in your build pipeline to block old national text keywords. This simple step stops old syntax before it ever reaches your production server.

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 3720 stop my query from running?

By default, code 3720 is a warning and the query still runs. Still, strict client rules or migration runners may stop when they see warnings.

Will changing from three-byte to four-byte UTF-8 break existing text?

No, the four-byte character set supports every character in the three-byte set. Still, test your table indexes first because four-byte columns need more index space.

Why do migration tools create national character columns in the first place?

Many database engines use national character types to store Unicode text by default. Migration tools often copy those types directly instead of switching to standard text types.

The query runs. The emails stay hidden.