本文主要是介绍mysql:[Err] 1055 - Expression #1 of ORDER BY clause,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
出现问题:
[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
现象:
安装好mysql-5.7.26后,建完表执行sql时,底部一直出现[Err] 1055
主要原因是:sql_mode=only_full_group_by不兼容
解决方法:
方法一:
只修改当前数据库:
-- 查看SQL_MODE
SELECT @@sql_mode;-- 修改SQL_MODE
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
效果:
方法二:
修改配置文件,对所有数据库生效
2.1 windows系统的mysql配置文件是my.ini
在mysql安装目录下
打开my.ini,添加以下语句后,重启mysql服务
[mysqld]
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.2 linux系统的mysql配置文件是my.cnf
在/etc/my.cnf,添加
[root@VM-0-17-centos mysql]# vim /etc/my.cnf
[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
#重启mysql服务
[root@VM-0-17-centos mysql]# service mysqld restart
Shutting down MySQL.... SUCCESS!
Starting MySQL. SUCCESS!
author:su1573
鄙人记录生活点滴,学习并分享,请多指教!!!
如需交流,请联系 sph1573@163.com,鄙人看到会及时回复
这篇关于mysql:[Err] 1055 - Expression #1 of ORDER BY clause的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!