How to Fix MySQL Error 1298 (ER_UNKNOWN_TIME_ZONE)
You get mysql error 1298 when the database cannot find a requested time zone name. You can fix it by loading system time zone tables or using numeric offsets. The official symbol for this failure is ER_UNKNOWN_TIME_ZONE under SQLSTATE HY000. The server returns a message stating that the time zone is unknown or incorrect. This guide explains why the database rejects your time zone and how to fix it. Why mysql error 1298 happens in your database MySQL stores time zone rules inside internal sys
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 1298 when the database cannot find a requested time zone name. You can fix it by loading system time zone tables or using numeric offsets.
The official symbol for this failure is ER_UNKNOWN_TIME_ZONE under SQLSTATE HY000. The server returns a message stating that the time zone is unknown or incorrect. This guide explains why the database rejects your time zone and how to fix it.
Why mysql error 1298 happens in your database
MySQL stores time zone rules inside internal system tables in the main database schema. During a fresh setup, the installer creates these tables but leaves them empty. If an app asks for a named zone like America/New_York, the lookup fails.
Numeric offsets like plus two hours always work without extra table data. Named time zones need full historical daylight saving rules to work right. When those rules are missing from the system tables, the engine throws mysql error 1298.
A mismatch between the host operating system and the database can also trigger this issue. Operating systems update their zone files when governments change daylight saving laws. If the host updates its files before the database does, new zone names fail.
Client apps and drivers often send their local zone name when they first log in. If a user laptop uses a zone name the server lacks, the session fails right away. Read replicas can also fail if primary servers do not replicate system table changes.
How to check your database and client setup
Start by checking whether your database system tables hold any time zone records. An admin can query the time zone name table inside the system schema. If that table returns zero rows, the server only knows numeric offsets and UTC.
If the table has rows, check the exact string that the client app sends. Typos, extra spaces, or wrong letter case in the app settings will trigger the error. You should also check the global and session time zone values on the server.
Mean Time to Detect (MTTD) + MySQL Access Governance: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Review your app logs to see which service or user session hits the error. Many drivers let you force a specific session offset during the initial login handshake. Setting a standard numeric offset in the driver avoids named zone lookups during login.
How to fix ER_UNKNOWN_TIME_ZONE safely in production
The best fix is to load the host operating system zone data into the database. MySQL provides a command line helper that reads OS zone files and writes SQL rows. An admin runs this utility and pipes the output into the system database schema.
Do not grant broad admin rights to normal app roles to run this update. Only a small admin role should write to internal system tables during a maintenance window. In managed cloud databases, use the provider parameter group settings instead of manual scripts.
If you cannot load system tables right away, switch your app to numeric offsets. Using UTC or a plus zero offset keeps timestamps consistent across all server nodes. Once you load the zone tables, test your queries in staging before updating production.
Keep your database zone tables in sync when you patch your Linux hosts. Schedule a routine check after operating system updates so new zone names stay valid. Standardizing on UTC for all database sessions prevents most time zone errors across teams.
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
Why do numeric offsets work when named time zones fail?
Numeric offsets only need simple math relative to UTC to shift a timestamp. Named time zones require historical lookup tables for daylight saving shifts, which may be empty.
Does loading time zone tables require a database restart?
Loading the zone tables updates rows in the system schema and works right away. If you change the global server setting file, you may need a reload or restart.
How do I fix this error on a managed cloud database?
Most cloud providers pre-load the time zone tables for you on every instance. You only need to pick a valid zone name in the cloud parameter group settings.
Related guides
In this post