Common SQL Errors

MySQL Error 3129: ER_WARN_DEPRECATED_SQLMODE_UNSET - How to Fix and Prevent

Galaxy Team
August 8, 2025

The warning appears when a session or global sql_mode is unset, a practice deprecated since MySQL 5.7.7.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 3129 ER_WARN_DEPRECATED_SQLMODE_UNSET?

ER_WARN_DEPRECATED_SQLMODE_UNSET signals that removing a value from sql_mode is deprecated in MySQL 5.7.7 and later. Leave the mode enabled or explicitly set the desired modes instead of unsetting them to eliminate the warning.

Error Highlights

Typical Error Message

ER_WARN_DEPRECATED_SQLMODE_UNSET

Error Type

Deprecation Warning

Language

MySQL

Symbol

read-only in a future release. ER_WARN_DEPRECATED_SQLMODE_UNSET was added in 5.7.7, removed after 5.7.7.

Error Code

3129

SQL State

HY000

Explanation

Table of Contents

What is MySQL error 3129 ER_WARN_DEPRECATED_SQLMODE_UNSET?

Error 3129 is a deprecation warning raised when an application or user tries to unset a sql_mode value in MySQL 5.7.7 or later. The server flags this because sql_mode will become read-only in future versions.

The warning does not stop query execution, but it indicates that current behaviour will break once sql_mode becomes immutable. Addressing it early avoids production issues during upgrades.

What Causes This Error?

MySQL raises the warning whenever SET GLOBAL sql_mode='' or SET SESSION sql_mode='' removes one or more existing modes. The parser detects the empty or reduced list and returns 3129.

Configuration files that override sql_mode by comment-ing out values also trigger it at server startup.

How to Fix ER_WARN_DEPRECATED_SQLMODE_UNSET

Stop unsetting sql_mode. Instead, define the exact combination of modes you need. If you truly want the default, query @@sql_mode on a clean instance and copy that list explicitly.

Updating application code and server configuration files ensures clean logs and future-proof behaviour.

Common Scenarios and Solutions

Legacy applications that cleared ONLY_FULL_GROUP_BY previously use SET sql_mode=''. Replace that line with SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')) to keep other modes intact.

Docker images with outdated my.cnf examples often unset STRICT_ALL_TABLES. Update the config to list desired modes instead.

Best Practices to Avoid This Error

Pin sql_mode in a single place, preferably the global my.cnf, and avoid changing it dynamically. Document required modes in version control.

Before upgrades, test code against the newer default sql_mode to catch query issues early.

Related Errors and Solutions

Warning 3135 (ONLY_FULL_GROUP_BY incompatible) indicates queries that fail once ONLY_FULL_GROUP_BY is active. Fix by rewriting GROUP BY clauses.

Error 1235 (ER_OPTION_PREVENTS_STATEMENT) appears when a statement is blocked by sql_mode settings. Adjust the query or mode accordingly.

Common Causes

Dynamic Clearing of sql_mode

Scripts execute SET SESSION sql_mode='' to bypass strict modes, immediately triggering the warning.

Configuration File Overrides

DBAs comment out sql_mode entries in my.cnf, causing MySQL to interpret an empty value and raise 3129 at startup.

Framework Default Settings

Older ORMs automatically clear ONLY_FULL_GROUP_BY for compatibility, now considered deprecated behaviour.

Related Errors

MySQL Warning 3135 ONLY_FULL_GROUP_BY

Raised when queries use non-aggregated columns without GROUP BY and ONLY_FULL_GROUP_BY is active.

MySQL Error 1235 ER_OPTION_PREVENTS_STATEMENT

Occurs when a statement is blocked because of sql_mode restrictions such as SAFE_UPDATES.

MySQL Warning 1287

Signals deprecated features similar to how 3129 flags deprecated sql_mode handling.

FAQs

Does error 3129 break queries?

No. It is a warning, so the query still runs, but it signals future incompatibility.

Can I ignore ER_WARN_DEPRECATED_SQLMODE_UNSET?

You can, but logs will be noisy and upgrades may fail when sql_mode becomes read-only.

Which MySQL versions show this warning?

It appears in MySQL 5.7.7 and remains in 8.x whenever sql_mode is unset.

How does Galaxy help with this warning?

Galaxy’s editor flags deprecated SQL patterns in real time. Team-reviewed snippets ensure sql_mode is set consistently across scripts.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo