无法将sql_mode设置为none

时间:2015-10-26 10:26:25

标签: mysql sql-mode

我使用版本5.7.9,如下面的mac El Capitan所示。

~  mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.9 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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> SELECT @@sql_mode;
+-------------------------------------------------------+
| @@sql_mode                                                                                                                                |
+--------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+----------------------------------------+
1 row in set (0.00 sec)

我创建了一个文件〜/ .my.cnf并添加了以下内容。

[mysqld]

sql_mode =''

我重新启动了mysql并再次检查了sql_mode,但没有区别。我在这里做错了什么?

1 个答案:

答案 0 :(得分:1)

首先修改my.cnf(ubuntu)my.ini(Windows)

对于ubuntu:sudo gedit /etc/mysql/my.cnf

更改您的设置,保存并关闭它。

重启mysql:sudo service mysql restart 所有更改都将保存。

然后再次检查:

mysql> SELECT @@GLOBAL.sql_mode;