Docker安装MySQL遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题

Docker安装MySQL遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题

用sql查询:

SELECT @@session.sql_mode;


去掉ONLY_FULL_GROUP_BY,重新设置值。

进入docker的MySQL容器,编辑/etc/mysql/mysql.conf.d/mysqld.cnf文件,在[mysqld]下添加如下:

[mysqld] 
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIO

保存,退出容器;

执行sudo docker restart MySQL ,重启MySQL即可。


你可能感兴趣的:(Docker安装MySQL遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题)