Mac在运行mybatis-generator插件时遇到错误
Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.4.0:generate (default-cli) on project springboot: 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.
尝试修改MySQL超时时间,使用命令行登录MySQL
mysql -u root -p
进入MySQL后,使用命令查看超时时间配置
show variables like '%timeout%';一、修改配置
我们需要到 my.cnf 配置文件中修改 interactive_timeout和wait_timeout两个参数的值,
在Mac中安装完MySQL后,my.cnf配置文件需要自己手动创建
cd /usr/local/etc mkdir mysql cd mysql touch my.cnf vim my.cnf
填入内容,保存关闭
[mysqld] wait_timeout = 38800 interactive_timeout = 38800二、使用配置文件
进入设置,选用刚才创建的配置文件
停止服务后重新启用即可



