ERROR 1055 (42000): Expression #1 of ORDER BY clause is not in GROUP BY..sql_mode=only_full_group_by

来源:互联网 发布:交趾郡 知乎 编辑:程序博客网 时间:2024/06/16 09:59


MySQL错误:Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'DB.table.column' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by


解决办法1:

(临时)在命令行中登陆Mysql,执行:

SET sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';


解决办法2:

(永久)在Mysql的配置文件my.cnf修改sql_mode值(去掉里面的ONLY_FULL_GROUP_BY),重启MySQL即可。


----- 配置文件my.conf在哪 -----

(0)Linux下,参考:Linux下MySQL配置文件my.ini位置,http://www.linuxidc.com/Linux/2013-01/77389.htm

(1)OSX下,需要自己复制出来, sudo cp /usr/local/mysql/support-files/my-medim.cnf /etc/my.cnf,重启mysql即可

(2)windows下,参考Windows下MySQL5.6查找my.ini配置文件,http://blog.csdn.net/mayor125/article/details/54140454






阅读全文
0 0
原创粉丝点击