JavaWeb项目,连接mysql数据库之后报出这个错误,在CentOS6.5系统下创建的项目,root用户下创建的数据库,没有设置密码
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
String url = "jdbc:mysql://127.0.0.1:3306/test";
把之前localhost改为127.0.0.1就好了
你用的是什么数据库连接池?
在配置文件里面设置参数。
然后配置下默认执行的SQL,我估计是你的默认sql没设置。
个人推荐c3p0 比较稳定,问题少