Linux下的MySQL8.0报错:[Err]1055
- 报错信息
- 解决办法
报错信息
在Linux
环境下的MySQL
里执行SQL
语句报如下错误:[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
解决办法
修改Linux
环境 MySQL
下的配置文件:/etc/my.cnf
(1)获取 sql_mode
字段内容: SELECT @@sql_mode;
SELECT @@sql_mode;
(2)去除 sql_mode
字段中的 only_full_group_by
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
(3)编辑配置文件: vim /etc/my.cnf
,将去除 only_full_group_by
后的 sql_mode
内容值添加至 my.cnf
文件中,保存后退出
(4)重启MySQL服务:
systemctl restart mysqld