How to change SQL mode 【MySQL】
1 min readAug 23, 2020
When you use MySQL, you can change SQL mode. Many settings are included in this, and the contents are written in my.cnf file.
How to find your my.cnf file
mysql --help | grep my.cnf#=> /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
Confirm your SQL mode
mysql> SELECT @@GLOBAL.sql_mode;ormysql> SELECT @@SESSION.sql_mode;
The former is a global setting, and latter is a session setting.
List of SQL Modes
How to change SQL mode
$ service mysql stop$ vi /etc/my.cnfsql-mode = 'sql-mode-name1,sql-mode-name2'ex. sql-mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE'$ service mysql start