通信链接错误mysql jdbc [英] Communication link error mysql jdbc
本文介绍了通信链接错误mysql jdbc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
当我想连接到我的数据库时出现此错误。
Hi guys,
I get this error when I want to connect to my database.
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 Workbench Eclipse和Apache。
我的代码是
I use MySQL Workbench Eclipse and Apache.
My code is
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection ("jdbc:mysql://127.0.0.1:3006/dblabor","root","root");
System.out.println("Connection successful");
提前感谢我希望有人可以提供帮助。 />
我的尝试:
Thanks in advance I hope someone can help.
What I have tried:
<pre>Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection ("jdbc:mysql://127.0.0.1:3006/dblabor","root","root");
System.out.println("Connection successful");
推荐答案
试试这个(假设您有默认端口号mysql)。
try this (assuming you have default port number for mysql).
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection ("jdbc:mysql://localhost:3306/dblabor","root","root");
System.out.println("Connection successful");
这篇关于通信链接错误mysql jdbc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文