What is Strict Mode?

Strict mode controls how MySQL handles invalid or missing values in data-change statements such as INSERT or UPDATE. A value can be invalid for several reasons.

Why to Disable?

If you do not disable the strict mode, you may encounter errors while using the script.

How to determine

the current global or session sql_mode setting? Select its value:

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

How to Change or Set the SQL mode?

Method 1: Set the global or session sql_mode system variable using a SET statement:

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

Method 2: Edit “sql-mode” value in MySQL configuration file (my.ini or my.cnf):

[mysqld] 
sql_mode="modes"

How to Disable or Turn off Strict Mode?

Method 1: Reset the global or session sql_mode system variable using a SET statement:

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

Method 2: Delete “sql-mode” value in MySQL configuration file (my.ini or my.cnf):

[mysqld] 
sql_mode=""

Leave a Reply

Your email address will not be published. Required fields are marked *