How to Disable MySQL Strict Mode

To Disable MySQL Strict Mode, edit

vi /etc/my.cnf

Add under [mysqld] section

sql_mode = ""

Verify MySQL Strict Mode

To check if MySQL is running in strict mode, run

SELECT @@sql_mode;

You get empty result if MySQL is not running under strict mode.

Here is a MySQL server running under strict mode

mysql> SELECT @@sql_mode;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode                                                                                                                                |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> 

After disabling MySQL strict mode

mysql> SELECT @@sql_mode;
+------------+
| @@sql_mode |
+------------+
|            |
+------------+
1 row in set (0.01 sec)

mysql>

mysql

Comments

Leave a Reply

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