进入容器
docker exec -ti docker_cm_mysql57_1 /bin/bash
或
winpty docker exec -it docker_cm_mysql57_1 bash
docker的mysql容器, 配置项是放在 /etc/mysql/conf.d
目录下.
cd /etc/mysql
ls
conf.d my.cnf my.cnf.fallback mysql.cnf mysql.conf.d
ls conf.d
custom.cnf docker.cnf mysql.cnf mysqldump.cnf
写入配置
在容器内,/etc/mysql/conf.d/下,*.cnf文件,将配置写入到里面
cd /etc/mysql/conf.d
touch custom.cnf
echo "[mysqld]" > custom.cnf
echo "sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" >> custom.cnf
或者
echo "sql_mode=" >> custom.cnf
重启服务
最后重启容器或直接在容器内重载(重启)mysql服务
service mysql reload
docker mysql5.7 only_full_group_by 问题 https://my.oschina.net/u/2518341/blog/3027062
mysql5.7 only_full_group_by错误解决方案
https://blog.csdn.net/qq_42175986/article/details/82384160