Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘dys_msme.scene_his_info.scene_his_id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘dys_msme.scene_his_info.scene_his_id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
修改配置文件
vi /etc/mysql/mysql.conf.d/mysqld.cnf
添加以下配置
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
重启msyql
systemctl restart mysql
FLUSH PRIVILEGES
在docker 中永久修改
映射配置文件
volumes:
- /workspace/config/mysql/datadir:/var/lib/mysql
- /workspace/config/mysql/conf:/etc/mysql/conf.d
- /workspace/config/mysql/conf/mysql.conf.d:/etc/mysql/mysql.conf.d
- /workspace/config/mysql/conf/my.cnf:/etc/mysql/my.cnf
- /workspace/config/mysql/logs:/var/log/mysql
在my.conf中添加以下代码
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
修改当前会话sql_mode
SET SESSION sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE';