[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated解决

[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated解决

运行sql语句时出现如下错误:
出错现象

解决方法

第一步:打开mysql安装目录
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated解决_第1张图片

第二步,打开my.ini文件
在my.ini中添加如下配置:
[mysql]
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
在命令行输入:
net stop mysql
net start mysql

【如果做完上面的步骤后,发现仍然报错】

配置文件出错!

新建配置文件my.ini时,使用了新建文档,保存时保存成了文本类型。查看文件扩展名进行检查
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated解决_第2张图片
发现my.ini.txt文件。配置文件类型出错,所以配置没有生效。
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated解决_第3张图片

新建my.ini配置文件方法

新建文本文件,点击另存为,更改文件名和保存类型(所有文件)
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated解决_第4张图片
最后重启mysql,问题解决!

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