How to change SQL mode 【MySQL】

When you use MySQL, you can change SQL mode. Many settings are included in this, and the contents are written in my.cnf file.

mysql --help | grep my.cnf#=>  /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
mysql> SELECT @@GLOBAL.sql_mode;ormysql> SELECT @@SESSION.sql_mode;

The former is a global setting, and latter is a session setting.

It is here => https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#:~:text=The%20default%20SQL%20mode%20in,NO_ZERO_DATE%20%2C%20ERROR_FOR_DIVISION_BY_ZERO%20%2C%20and%20NO_ENGINE_SUBSTITUTION%20

$ 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