mysql - 无法连接MySQL服务器,org.netbeans.api.db.explorer.DatabaseException,通信链路失败

标签 mysql netbeans

当我尝试注册 MySQL 服务器时,我在弹出窗口中收到以下错误

Unable to connect to the MySQL server: 

org.netbeans.api.db.explorer.DatabaseException: org.netbeans.api.db.explorer.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 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.. 

The server may not be running or your MySQL connection properties may not be set correctly. Do you want to edit your MySQL connection properties? 

如何解决这个问题?

最佳答案

就我而言,J 驱动程序文件丢失。所以首先从https://dev.mysql.com/downloads/connector/j/下载驱动程序 然后安装它。安装后它将被放置在

/usr/share/java/mysql-connector-java-8.0.18.jar 

(仅供引用:您的驱动程序版本可能有所不同。)

现在您必须在 netbeans 中添加该文件,即转到“服务”>“驱动程序”。 右键单击 MySQL(连接器/J 驱动程序)> 自定义 单击“添加”。

给出路​​径

/usr/share/java/mysql-connector-java-8.0.18.jar 

单击“确定”。

现在再次右键单击 MySQL(连接器/J 驱动程序)> 连接使用... 或者 (用于特定Schema的连接) 右键单击位于 localhost:3306 的 MySQL Server > 连接 然后右键单击您要连接的特定架构。 仅供引用:为了您的方便,将默认的长名称重命名为数据库名称。

提供用户名(通常为 root)和密码以及数据库。

关于mysql - 无法连接MySQL服务器,org.netbeans.api.db.explorer.DatabaseException,通信链路失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35902862/

相关文章:

php - jQuery 向 php 发送多个需求

MySQL : weekly and monthly average

java - 是否可以在 Java Netbeans 上制作渲染的 jTextArea "format editable"? (使用 Enter 和 Tab 键)

Java DB Derby 和 Netbeans 7.1 构建问题

NetBeans 更改 "create method"提示行为

java - Netbeans IDE 7.4 ctrl+空格错误

php - 如何抛出验证错误

mysql - 用 SQL 形成数据库

java - Netbeans 的项目属性中缺少包装

mysql - 如何修复具有多个总和的查询mysql