HostOnNet Blog

Disable MySQL Strict Mode

Looking for Linux Server Admin or WordPress Expert? We can help.

To disable MySQL strict mode, edit my.cnf file

vi /etc/my.cnf

Find something like following.

sql_mode=ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Replace with

sql_mode=""

Now restart MySQL

systemctl restart mysql

Verify MySQL Strict Mode

To verify if you are running MySQL on strict mode or not, run

SELECT @@sql_mode;

If MySQL is not running under strict mode, you see empty result like

boby@hon-pc-01:~$ mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2 Ubuntu 16.04

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SELECT @@sql_mode;
+------------+
| @@sql_mode |
+------------+
|            |
+------------+
1 row in set (0.00 sec)

MariaDB [(none)]> 

See MySQL

Posted in MySQL

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.