在 ?mysql 5.7版本 出現(xiàn) ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql> set global sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'' at line 1?
我是因為 執(zhí)行 了 group by 語句 出錯的
select * from recordTable group by user_number;
在 mysql ?中 查看:
mysql> select @@session.sql_mode;
出現(xiàn):
這個時候 你需要把 ONLY_FULL_GROUP_BY 去掉
找到 my.cnf 配置文件
vim ? /etc/my.cnf
在 mysqld 模塊 最后面 輸入
sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
如:
然后保存 重啟 mysql 服務?
可以重新 執(zhí)行下 mysql> select @@session.sql_mode;
這個時候 已經(jīng)沒有了 ONLY_FULL_GROUP_BY