How to disable strict mode in Mysql

MySQL’s, and MariaDB’s, strict mode controls how invalid or missing values in data changing queries are handled; this includes INSERT, UPDATE, and CREATE TABLE statements. With MySQL strict mode enabled, which is the default state, invalid or missing data may cause warnings or errors when attempting to process the query.

This article explains the steps to disable strict mode.

Step1: Open the configuration file

#vi /etc/my.cnf

Step2: Replace the following line

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

with,

sql_mode=""

Step3: Restart Mysql service

#/etc/init.d/mysql restart

Step4: Verify the changes

#mysql -e "SELECT @@sql_mode;"

The output may look similar to the following:
+--------------------------------------------+
| @@sql_mode
+--------------------------------------------+
| NO_AUTO_CREATE_USER
+--------------------------------------------+

 

That's all...

 

Leave a Reply

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