mysql 5.7版本 出现 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

在  mysql 5.7版本 出现 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 

我是因为 执行 了 group by 语句 出错的

select * from recordTable group by user_number;

在 mysql  中 查看:

mysql> select @@session.sql_mode;

出现:


mysql 5.7版本 出现 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_第1张图片

这个时候 你需要把 ONLY_FULL_GROUP_BY 去掉

找到 my.cnf 配置文件

vim   /etc/my.cnf

在 mysqld 模块 最后面 输入

sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

如:

mysql 5.7版本 出现 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_第2张图片

然后保存 重启 mysql 服务 

可以重新 执行下 mysql> select @@session.sql_mode;

这个时候 已经没有了 ONLY_FULL_GROUP_BY


mysql 5.7版本 出现 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_第3张图片

你可能感兴趣的:(mysql 5.7版本 出现 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)