<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/post//</link>
<title><![CDATA[mysql报错：ORDER BY clause is not in GROUP BY clause and contains nonaggregated column]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[数据库]]></category>
<pubDate>Wed, 03 Nov 2021 01:44:42 +0000</pubDate> 
<guid>https://www.heckjj.com/post//</guid> 
<description>
<![CDATA[ 
	在mysql5.7以及之后的版本运行sql语句时，出现以下问题：<br/>[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by<br/><br/>出现问题的原因：<br/>MySQL 5.7.5及以上功能依赖检测功能。如果启用了ONLY_FULL_GROUP_BY SQL模式（默认情况下），MySQL将拒绝选择列表，HAVING条件或ORDER BY列表的查询引用在GROUP BY子句中既未命名的非集合列，也不在功能上依赖于它们。（5.7.5之前，MySQL没有检测到功能依赖关系，默认情况下不启用ONLY_FULL_GROUP_BY<br/><br/>解决办法：<br/>把 sql_mode中的 only_full_group_by 去掉即可<br/>办法一：（只在当前查询页面有效，不能一次性解决问题！）<br/><br/>查询sql_mode： select version(), @@sql_mode;<br/>修改为： SET sql_mode=(SELECT REPLACE(@@sql_mode,‘ONLY_FULL_GROUP_BY’,’’));<br/>办法二： 修改 my.cnf 文件的 sql_mode （一次性解决问题）<br/><br/>查找 my.cnf 文件： find / -name my.cnf 或者 whereis my.cnf<br/>获取 sql_mode字段内容： SELECT @@sql_mode;<br/>去掉 sql_mode字段中的 only_full_group_by<br/>编辑 my.cnf： vim /etc/my.cnf 将上一步骤的 sql_mode 字段内容添加至 my.cnf。可参考：sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION<br/>保存，重启： systemctl restart mysqld.service
]]>
</description>
</item><item>
<link>https://www.heckjj.com/post//#blogcomment</link>
<title><![CDATA[[评论] mysql报错：ORDER BY clause is not in GROUP BY clause and contains nonaggregated column]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>