7

How do I enable MySQL strict mode globally, and have it stay on?

I have tried these commands:

SET sql_mode = TRADITIONAL;
SET sql_mode = ANSI_QUOTES;

But they only set the mode for the current session.

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Chris Muench
  • 17,444
  • 70
  • 209
  • 362
  • Possible duplicate of [MySQL: Setting sql\_mode permanently](http://stackoverflow.com/questions/20373532/mysql-setting-sql-mode-permanently) – Michael Currie Aug 05 '16 at 09:41

1 Answers1

1

To set the SQL mode at server startup, use: - the --sql-mode="modes" option on the command line, or - sql-mode="modes" in an option file such as my.cnf (Unix operating systems) or my.ini (Windows). ("modes" is a list of different modes separated by commas.)

Reference: https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html

Michael Currie
  • 13,721
  • 9
  • 42
  • 58
ABC
  • 159
  • 2
  • 16