2

我在 mac El Capitan 上使用如下所示的 5.7.9 版本。

~  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,但没有任何区别。我在这里做错了什么?

4

1 回答 1

1

第一次编辑my.cnf(ubuntu)my.ini(Windows)

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


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


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


然后再次检查:


mysql> SELECT @@GLOBAL.sql_mode;
于 2016-10-21T12:56:28.140 回答