How to Fix MySQL Error 4095 (ER_WARN_DEPRECATED_DATETIME_DELIMITER)

Published
Length
3 min read

Luis Felipe Dias

All posts

You trigger mysql error 4095 when a query uses old symbols inside date or time values. To fix it, format dates with dashes and times with colons, separated by one space. MySQL flags this issue with the symbol ER_WARN_DEPRECATED_DATETIME_DELIMITER and SQLSTATE value HY000. The engine warns that a character at a specific position and row is out of date. It also tells you which standard character to use instead. What causes mysql error 4095 in your database Older database releases let apps send

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 trigger mysql error 4095 when a query uses old symbols inside date or time values. To fix it, format dates with dashes and times with colons, separated by one space.

MySQL flags this issue with the symbol ER_WARN_DEPRECATED_DATETIME_DELIMITER and SQLSTATE value HY000. The engine warns that a character at a specific position and row is out of date. It also tells you which standard character to use instead.

What causes mysql error 4095 in your database

Older database releases let apps send dates and times with almost any punctuation mark. Developers could use slashes, dots, or random symbols between year, month, and day numbers. The database parser still guessed the right date and saved the row.

Modern MySQL versions push teams to use strict standard formats for all temporal data. When the parser sees a non-standard delimiter at a given position, it raises code 4095. For date parts, the database expects a hyphen between the year, month, and day. Between the date and the time, the parser expects a single space or the capital letter T. For time parts, the engine expects a colon between hours, minutes, and seconds.

This message starts as a deprecation warning rather than a hard stop in default setups. Still, strict SQL modes in production can turn warnings into failed writes right away. Even if writes succeed today, future MySQL releases will drop support for custom delimiters.

How to find the bad date strings in production

Start by reading the exact warning message returned by the database server. The message lists the bad character, its character position, the full value, and the row number. This detail points you straight to the broken input inside a batch insert or update.

Check your app logs and slow query logs to find which service sends these strings. Look for manual string building where code joins date parts with slashes or dots. Also check CSV import jobs, data pipelines, and third-party webhooks that push raw text into tables.

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 inspect live production data to debug broken rows, protect sensitive columns first. Data masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in results. This lets engineers check date columns in real records without exposing private customer details.

How to fix the delimiter warning safely

Do not lower your SQL mode or hide warnings in your database settings to silence this alert. Turning off strict checks lets bad data slip into your tables and breaks future upgrades. Also avoid granting broad admin rights to app roles just to bypass validation rules.

Instead, fix the date format at the app layer before sending queries to the database. Update your code to format every date as four-digit year, two-digit month, and two-digit day with hyphens. Format every time value with colons between hours, minutes, and seconds.

Use prepared statements and native date objects in your programming language instead of raw text strings. Database drivers convert native date objects into the exact wire format that MySQL expects. If you load data from flat files, clean the date columns in your staging script before import. Test the updated queries in a staging setup and check that warning counts drop to zero.

Check MySQL queries and results on the wire

MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.

Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.

Frequently asked questions

What does ER_WARN_DEPRECATED_DATETIME_DELIMITER mean in MySQL?

It means your query passed a date or time string with an old separator symbol. MySQL wants you to replace that symbol with a standard hyphen, colon, or space.

Does MySQL Error 4095 block my insert or update query?

In standard modes it acts as a warning and still writes the row. If your session runs in strict error mode, the database rejects the query right away.

Which characters should I use for MySQL datetime values?

Use hyphens between date numbers and colons between time numbers. Put a single space or a capital T between the date part and the time part.

The query runs. The emails stay hidden.