将mysql连接到Java netbeans时出错 [英] error when connecting mysql to Java netbeans
问题描述
我正在尝试将connector/j driver
连接到 Netbeans .
I am trying to connect a connector/j driver
to Netbeans.
我正在按照以下步骤进行连接,
I am following below steps to connect,
- 在服务中,我右键单击并单击新连接.
- 然后浏览并添加
mysql-connector-java-5.1.23-bin.jar
文件. - 然后单击下一步.
- 然后是
JDBC url : jdbc:mysql://localhost:3306/mysql
是 正在显示. - 我点击测试连接按钮
- In services I right click and click new connection.
- then I browse and add
mysql-connector-java-5.1.23-bin.jar
file . - Then click next.
- Then comes a
JDBC url : jdbc:mysql://localhost:3306/mysql
is showing. - I click the test connection button
然后我得到以下错误:
无法建立连接 使用com.mysql.jdbc到jdbc:mysql://localhost:3306/mysql 驱动程序(通讯链接失败) 成功发送到服务器的最后一个数据包为0毫秒. 尚未从服务器接收到任何驱动程序包.)
Cannot establish a connection to jdbc:mysql://localhost:3306/mysql using com.mysql.jdbc. Driver (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.)
推荐答案
我个人也遇到了这个问题. Netbeans有时在处理MySQL时遇到问题.我建议您下载MySQL Community Server和MySQL Workbench并使用它们来运行数据库.它效率更高,并且可以让您更好地控制数据库.
I've personally had this problem too. Netbeans sometimes has problems dealing with MySQL. I would suggest you download MySQL Community Server and MySQL Workbench and use those to run your database. It's much more efficient and gives you more control over your database.
这篇关于将mysql连接到Java netbeans时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!