JDBC连接MySql遇到的问题

问题描述:

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

SQLState: 08S01

VendorError: 0

 

问题解决的办法:

端口号不一致,本来是3307,想当然以为是3306

 

相关知识延伸:

  mysql的几个常见查询语句

1.查询端口号: show global variables like 'port'

2.查询最大连接数: show variables like '%max_connections%'

3.查询wait_timeout 等参数: show global  variables like '%timeout';  (注意:加不加global区别是有的)

  解决问题中尝试的方法:在my.cnf中修改MySql中wait_timeout等参数

  MySql的路径(本人的电脑):/usr/local/mysql-5.6.26-osx10.8-x86_64   下的文件my.cnf  

 

posted @ 2016-04-19 15:43  奔跑的大龙猫  阅读(167)  评论(0编辑  收藏  举报