Sql_mode无法更改问题

sql_mode无法更改

目前支持的 SQL_MODE 列表

SQL_MODE 修改方式:

mysql> show variables like '%sql_mode%';
+---------------+--------------------------------------------+
| Variable_name | Value                                      |
+---------------+--------------------------------------------+
| sql_mode      | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
+---------------+--------------------------------------------+
1 row in set (0.01 sec)

mysql> set @@global.sql_mode='STRICT_TRANS_TABLES';
Query OK, 0 rows affected (0.06 sec)

mysql> show variables like '%sql_mode%';
+---------------+--------------------------------------------+
| Variable_name | Value                                      |
+---------------+--------------------------------------------+
| sql_mode      | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
+---------------+--------------------------------------------+
1 row in set (0.00 sec)

mysql> exit
Bye
[tidb@tidb-232 ~]$ mysql -u root -h 127.0.0.1 -P 4001
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 5872
Server version: 5.7.25-TiDB-v3.0.2 MySQL Community Server (Apache License 2.0)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> show variables like '%sql_mode%';
+---------------+---------------------+
| Variable_name | Value               |
+---------------+---------------------+
| sql_mode      | STRICT_TRANS_TABLES |
+---------------+---------------------+
1 row in set (0.01 sec)

嗯嗯 可以了 多谢

1赞