SQL _mode system variables can regulate MySQL SQL mode. Any client can change the MySQL server's response to itself without affecting other clients.
Www.2cto.com if you want to set the SQL mode when MySQL starts, you can add the SQL _mode option SQL-mode = "TRADITIONAL" to the mysql configuration file. If you modify the SQL mode during running, you can use the following command setsql_mode = "TRADITIONAL"; www.2cto. comClient1 mysql> show variables like "SQL _mode "; + --------------- + ------- + | Variable_name | Value | + --------------- + ------- + | SQL _mode | + --------------- + ------- + 1 row in set (0.00 sec) mysql> set SQL _mode = "TRADITIONAL"; Query OK, 0 rows affected (0.23 sec) mysql> show variables like "SQL _mode "; + --------------- + variable | Variable_name | Value | + ------------- + hour | SQL _mode | STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO
_ DATE, ERROR_FOR_DIVISION_BY_ZERO, TRADITIONAL, NO_AUTO_CREATE_USER, NO _
ENGINE_SUBSTITUTION | + --------------- + Route 1 rowin set (0.00 sec) mysql> Client2Client1 has modified the SQL mode, but the SQL mode of Client2 has not changed. This indicates that the mode between clients is modified.
Are mutually unaffected mysql> show variables like "SQL _mode "; + --------------- + ------- + | Variable_name | Value | + --------------- + ------- + | SQL _mode | + --------------- + ------- + 1 row in set (0.00 sec) mysql> set GLOBAL variables (to set GLOBAL variables, add the GLOBAL keyword and require SUPER permission) mysql> set globalsql_mode = "traditional"; Query OK, 0 rows affected (0.02 sec)
Select @ session. SQL _mode -- view the current session SQL mode select @ GLOBAL. SQL _mode -- View System session SQL mode after setting global variables, the new client is connected to the global SQL mode by default.