文章目录
- 1. 现象
- 2. docker内部mysql容器 解决方案
- 3. windows和linux 解决方案
1. 现象
在使用sql语句创建表时,报错:
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
2. docker内部mysql容器 解决方案
修改配置文件:在配置文件里加一句就可以了:
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
如果是docker中mysql容器请参考这篇博客,修改的是同一个文件
解决Linux docker中的mysql区分大小写问题
3. windows和linux 解决方案
windows的在安装目录里找到my.ini或者centos7在/etc/my.cnf中,添加内容如下:
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
,添加内容进去后,关掉mysql服务重启
# 关
net stop mysql
# 启
net start mysql
centos7在/etc/my.cnf中添加,重启
service mysqld restart或者 systemctl restart mysqld