我在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,但没有差异。我哪里做错了?
首次编辑my.cnf(ubuntu)
或my.ini(Windows)
ubuntu: sudo gedit /etc/mysql/my.cnf
更改设置,保存并关闭。
重启mysql: sudo service mysql restart
所有更改将被保存。
然后再检查:
mysql> SELECT @@GLOBAL.sql_mode;