为什么要修改呢 因为登录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.
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 ~
|