Skip to main content

Server SQL Modes

The MySQL server can operate in different SQL modes, and can apply these modes differently for different clients, depending on the value of the sql_mode system variable. DBAs can set the global SQL mode to match site server operating requirements, and each application can set its session SQL mode to its own requirements.

SET GLOBAL sql_mode = 'modes';
SET SESSION sql_mode = 'modes';

SELECT @@GLOBAL.sql_mode;
SELECT @@SESSION.sql_mode;

SQL mode and user-defined partitioning

Changing the server SQL mode after creating and inserting data into partitioned tables can cause major changes in the behavior of such tables, and could lead to loss or corruption of data. It is strongly recommended that you never change the SQL mode once you have created tables employing user-defined partitioning.

When replicating partitioned tables, differing SQL modes on the source and replica can also lead to problems. For best results, you should always use the same server SQL mode on the source and replica.

Modes

7.1.11 Server SQL Modes