mysql提示sql_mode=only_full_group_by 报错 如何解决

经常报出这种莫名其妙的错误,如何解决呢?

一般这种情况是mysql配置出现了问题,需要改配置文件。

Expression #2 of SELECT list is not in GROUP BY clause and contains
nonaggregated column
‘information_schema.USER PRIVILEGES.TABLE CATALOG’which is not
functionally dependent on columns in GROUP BY clause; this is
incompatible with sql_mode=only_full_group_by

 

image

 

解决方法:

找到文件路径 e:/phpstudy_pro/Extensions/MySQL5.7.26/my.ini,这个需要根据自己情况,找到安装mysql的目录,我是用的phpstudy,所以目录是这样的。然后打开my.ini文件,搜索 sql_mode ,如果没有,则添加即可。

sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

 

 

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享