赞
踩
为什么要修改呢
因为登录mysql时遇到了如下错误
mysql: [ERROR] unknown variable ‘sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION’
springboot项目运行报错
errorCode 0, state 08S01
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
# 查看容器name或id(我的name为mysql5.7)
docker ps
# 进入容器
docker exec -it mysql5.7 bash
# 修改文件
vim /etc/mysql/mysql.conf.d/mysqld.cnf
mysql:5.7.15容器中mysqld的配置文件是放在:/etc/mysql/mysql.conf.d/mysqld.cnf
修改之后重启容器
# 重启容器
docker restart mysql5.7
查看当前sql
mysql> select @@sql_mode;
附上临时修改的方法,此设置在重启mysql服务后会失效
select @@sql_mode
set @@sql_mode="NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES"
over ~
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。