CertGrid CertGrid
Concepts·MySQL

MySQL SQL Mode and Strict Behaviour

sql_mode decides whether bad data is an error or a silent correction. Relaxing it turns the out-of-range failure from the constraints guide into a row that stores 99999999.99 and says nothing.

Configuration Guide 15 of 45 Intermediate

Strict mode has been the default since 5.7. Servers upgraded from 5.6 often carry a relaxed sql_mode forward in their config, which is where most surprises of this kind come from.

Every command on this page ran on db-a01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB

This guide includes

Use this when bad data is being silently corrected instead of refused. This matters because sql_mode is what decides that - turning strict mode off makes a previously failing insert succeed, storing a value you did not mean.

Before you start

  1. Read the modes this server enforces

  2. Turn strict mode off and repeat a statement that failed

  3. Confirm the bad row is really there

Official sources