mysql数据库执行查询遇到 Expression #2 of SELECT list is not in GROUP BY的问题

只要执行sql语句,就会抛出错误:

Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column。。。
which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by;

这个sql语句违背了sql_mode=only_full_group_by 。



解决办法:
在登入mysql后,执行SET @@GLOBAL.sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
就可以将问题处理,但是重启计算机后还是会有这个错误。尚未解决

先mark一下。





找到彻底解决问题的方法,在mysql的根目录下新建一个my.ini文件就完美解决问题。

你可能感兴趣的:(mysql数据库)