错误信息
在执行sql:select * from tablename group by id;
错误信息
1 | [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版本是8.0的,5.7版本后的设置sql_mode=only_full_group_by
网上搜索解决方案是直接修改mysql配置文件(我的系统是Ubuntu16.04的,在/etc/mysql/mysql.conf.d/mysqld.cnf
中并没有sql_mode这个配置,所以直接加上就好,如果是其他系统有得修改就不用添加了)
加上如下配置:
1 | 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服务失败。
sql_mode中去除NO_AUTO_CREATE_USER。
重启成功。