idea连接MYSQL报错汇总
【The last packet sent successfully to the server was 0 milliseconds ago.The driver has not received any packets from the server.】
原因:mysql57 运行在非默认端口号
解决:
1.测试本地连接mysqsl57
打开C:\ProgramData\MySQL\MySQL_Server_57\my.ini
查找文件中的【port=】,发现端口号为【13306】
管理员权限打开shell, 同时输入用户名【xxx】,密码【xxx】,端口号【13306】
mysql -uxxx -plxxx -P13306
成功进入登录shell
【DBMS: MySQL (no ver.) Case sensitivity: plain=mixed, delimited=exact [08S01] Communications link failure. The last packet successfully received from the server was 245 milliseconds ago. The last packet sent successfully to the server was 225 milliseconds ago. No appropriate protocol (protocol is disabled or cipher suites are inappropriate).】
原因:之前系统变量【Path】中设置的MYSQL路径为mysql80的bin路径,因此尽管IEAD的【Data Source】, 【Driver】设置都正确了(如下)还是报错
Unix Socket【jdbc:mysql:///{database}?[?<&,user={user},password={password},junixsocket.file={mysql.socket::/tmp/mysqld.sock},socketFactory={socketFactory:#param:org.newsclub.net.mysql.AFUNIXDatabaseSocketFactoryCJ},{:identifier}={:param}>]】
default:【jdbc:mysql://{host::localhost}?[:{port::13306}][/{database}?][?<&,user={user},password={password},{:identifier}={:param}>]】
default: 【jdbc:mysql://address=(protocol=tcp)(<)(,host={host:host_ipv6:localhost},port={port::13306},user={user},password={password},{:identifier}={:param}>)[/{database}][?<&,{:identifier}={:param}>]】
解决:
创建系统变量【MYSQL】,变量值为【%MYSQL_57%】,
变量【MYSQL_57】, 变量值为【E:\MySQL\MySQL_Server_57\bin】