解决this is incompatible with sql_mode=only_full_group_by问题

sql执行报错
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘database_tl.emp.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
解决方法:
想要彻底解决这个问题 就得去改my.ini 配置(如果你们mysql 没有这个文件,就把my-default.ini 改成my.ini,我这个版本就是没有my.ini配置问题)
在 [mysqld]和[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’

我的配置文件在/etc/my.cnf
vi /etc/my.cnf 解决this is incompatible with sql_mode=only_full_group_by问题_第1张图片
修改完成后保存,重启mysql服务
systemctl restart mysqld.service

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