MySQL sql_mode Checker
The sql_mode variable decides how strict MySQL is: whether a bad date, a too-long string or a missing NOT NULL value is rejected or quietly adjusted, whether GROUP BY must list every selected column, and what double quotes and || mean. Small mistakes in the value are common. MySQL 8.0 removed NO_AUTO_CREATE_USER and the 5.7 compatibility modes, so a my.cnf copied from 5.7 fails with ERROR 1231 and mysqld will not start. A space after a comma is also an error, and combination modes such as ANSI and TRADITIONAL expand into several modes. Paste a SET statement, a my.cnf line or the output of SELECT @@sql_mode. The checker applies the same parsing rules as the server: the value is case-insensitive, trailing spaces are trimmed, empty items are skipped, and numeric bit masks are accepted. It shows the exact value SELECT @@sql_mode would return, any error or warning with its code (1231, 1232, 3899, 3135, 3090), what each active mode changes, and how the value differs from the 8.0+ default. If the value is invalid, it builds a corrected list and gives you the SET SESSION, SET GLOBAL, SET PERSIST and my.cnf lines for it. Click a mode below the result to switch it on or off. Results were checked against MySQL 8.0.46 and 8.4.11 on thousands of generated values. Everything runs in your browser.
Do more than mysql sql_mode checker — meet Chat2DB
Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace.
How to use
- Paste a SET sql_mode statement, a sql_mode line from my.cnf, or the value returned by SELECT @@sql_mode.
- Click Check to see the stored value, any error or warning, and what each active mode does.
- Toggle modes on or off, then copy the generated SET SESSION, SET GLOBAL, SET PERSIST or my.cnf line.
Frequently asked questions
Why does MySQL 8 say "Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'"?
NO_AUTO_CREATE_USER was removed in MySQL 8.0 together with the POSTGRESQL, ORACLE, MSSQL, DB2, MAXDB, MYSQL323, MYSQL40, NO_KEY_OPTIONS, NO_TABLE_OPTIONS and NO_FIELD_OPTIONS modes. Any SET statement, my.cnf line or application connection string that still lists one of them fails with ERROR 1231, and an option file with it stops mysqld from starting. Remove the name from the list. NO_AUTO_CREATE_USER needs no replacement because MySQL 8.0 never creates a user from a GRANT statement.
How do I remove ONLY_FULL_GROUP_BY without losing the other modes?
Read the current value with SELECT @@GLOBAL.sql_mode, take ONLY_FULL_GROUP_BY out of the list and set the rest back, for example SET PERSIST sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'. Setting sql_mode = '' also clears strict mode, which lets bad data in silently. The better long-term fix is to correct the query, by adding the column to GROUP BY or wrapping it in ANY_VALUE(). SET GLOBAL and SET PERSIST only affect new connections. Existing connections keep their session value.
Why do I get warning 3135 when I set STRICT_TRANS_TABLES?
MySQL wants NO_ZERO_DATE, NO_ZERO_IN_DATE and ERROR_FOR_DIVISION_BY_ZERO to be used together with strict mode, because they are planned to be merged into it. Warning 3135 appears when strict mode is on without all three, or when any of the three is on without strict mode. The value is still applied. Setting all four together, as the default does, avoids the warning. Chat2DB shows session and global variables next to your queries and can explain errors like 1055 or 1292 with its AI assistant: download it at chat2db.ai/download or use app.chat2db.ai in the browser.
