Via the MySQL command line client, I am trying to set the global mysql_mode:
SET GLOBAL sql_mode = TRADITIONAL;
This works for the current session, but after I restart the server, the sql_mode goes back to its default: '', an empty string.
How can I permanently set sql_mode to TRADITIONAL?
If relevant, the MySQL is part of the WAMP package.
Thank you.
Add this to your my.cnf file (or my.ini if you're using windows):
and restart the server
MySQL sql_mode
"TRADITIONAL"
, a.k.a. "strict mode", is defined by the MySQL docs as:Here's how to ensure that your sql_mode is set to
"TRADITIONAL"
.First, check your current setting:
This returned blank, the default, that's bad: your sql_mode is not set to "TRADITIONAL".
So edit the configuration file:
Add this line in the section labelled
[mysqld]
:sql_mode="TRADITIONAL"
(as fancyPants pointed out)Then restart the server:
Then check again:
Success! You are golden now.