Due to having to maintain compatibility with coping with old and perhaps broken codes, I decided to turn off mysql strict mode. It started with the php paging spurting out  database error such as “Error Number 1265”

1\As well as these “Error Number 1292”


This happens because MySQL server is running on strict mode, and the queries might have not properly constructed for it to run on a strict mode, or was constructed for an older version of MySQL. Yes, yes, the proper way to handle this kind of stuff is to fix the code and the database records, but for temporary fix, disabling strict mode should do it.

First, check if strict mode is active:

[surfer@www ~]# mysql -e "SELECT @@sql_mode;"
| @@sql_mode                                 |

Now, to turn it off, you need to make some change to your my.cnf with your favorite text editor. Your mysql installation might perhaps reading from more than a single my.cnf file. Locate them by doing:

[surfer@www usr]# mysqladmin --help

Look around the output for something similar to this:

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

Piece of cake, right? Well, I can’t have it easy can I? The file

[root@www usr]# locate my.cnf

This should give you the list of my.cnf file that exist in your system:

[root@www usr]# locate my.cnf

You  might have to check every single one of them to find whether one, or some of them has the “sql_mode” on its’ [mysqld]. I found mine at “/usr/my.cnf”

So, look for [mysqld], and find the sql_mode line, it should look like this:


To disable strict mode, edit the line to:


save, and restart mysql by doing:

sudo systemctl restart mysqld

Or on a pre-systemd do:

sudo service mysqld restart

Now, let’s check if strict mode has been disabled:

[surfer@www ~]# mysql -e "SELECT @@sql_mode;"
| @@sql_mode |
|            |

If your output is similar to this, we have successfully disable MySQL strict mode and those error above should disappear.



By ikhsan

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.