Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After upgrading to MySQL 5.5 from the Remi-DB (CentOS 6) we've been getting an issue where every reboot our SQL server will set itself back to strict mode:

mysql> SELECT @@GLOBAL.sql_mode;
| @@GLOBAL.sql_mode                          |

Then I run the command:

    mysql> SET GLOBAL sql_mode="";
Query OK, 0 rows affected (0.00 sec)

And that works fine for the session, but on restart this change is lost (I've also tried setting "SET SESSION" sqlmode as well.

I'd also like to note that I've tried this in the my.cnf files as well.

The only viable solution is to code an init file to run the SET GLOBAL sql_mode on restart but that's cumbersome, annoying, and unreasonable, there's got to be a way to make this work right off the bat.

I've tried a reinstall of the SQL server to no avail. (I did however pull back in the data from a backup of course as this is a production server.)

share|improve this question
up vote 9 down vote accepted

This bit me too on Percona Server v5.5.30-30.1-log.


and check for a /usr/my.cnf or similar file ($MYSQL_HOME/my.cnf) that might have been created by mysql_install_db.

This was overriding our sql_mode setting in all our other config files.

share|improve this answer
Can confirm having the same issue (and solution) with openSuse 13.1. Thanks! – davil Jun 17 '14 at 9:57
Centos 7.2 and mysql 5.6 had the same proble. Please check that /usr/my.cnf – mOrSa Apr 21 at 11:36

Add this in your my.cnf and restart MySQL. Make sure there is no other line after that to overwrite it.




sometimes adding below lines might work too. Try above first and if it doesn't work try these.



share|improve this answer
As mentioned I've already tried this. – Matthew Salsamendi Mar 6 '13 at 18:47
sql-mode="" works for me. Both in /etc/my.cnf and in /usr/my.cnf. – Ivan Borisenko Apr 29 at 11:31

I know this is old, but in case anyone needs it:

I was getting this with MySQL Server 5.6 on Windows 7 x64.

Turns out it loads a my.ini file here:

C:\ProgramData\MySQL\MySQL Server 5.6\my.ini

Even though MySQL was installed and runs from here:

C:\Program Files\MySQL\MySQL Server 5.6

Changing the sql mode in ProgramData ini to the following, then restarting MySql solved the issue:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.