gpt4 book ai didi

java - 远程 MYSQL 数据库访问

转载 作者:行者123 更新时间:2023-11-29 02:38:05 25 4
gpt4 key购买 nike

我用 java 开发了一个访问远程 mysql 数据库的应用程序。当我通过运行该 wamp 服务器的系统的 netbeans IDE 运行它时。但是当我尝试通过 netbeans 在另一个系统中连接到远程系统数据库时,它显示以下错误。

无法添加连接,Cannot establish a connection to jdbc:mysql://192.168.1.14:3306/test using(CommunicationsException: Communications link failure

发送到服务器的最后一个数据包是 0 毫秒前。

请帮助我。

提前致谢

最佳答案

来自 mysql forums

You could be getting this because (1) the URL of the DB is wrong, because (2) the DB isn't set up to accept connections from the web host, or because (3) some intermediate networking component is misconfigured. (1) is your problem; (2) and (3) might be your problem or the web hosting's problem, depending on where the DB is located, what administrative privileges on the DB that you have, and how the networking is set up.

您需要有适当的权限才能远程连接到 MySQL。有多种工具可用于设置它。

Here是一篇概述几个步骤的文章,其中最常需要授予步骤。

mysql> GRANT ALL ON foo.* TO bar@'202.54.10.20' IDENTIFIED BY 'PASSWORD';

在 Windows Vista 中连接到 MySQL 数据库时也报告了问题,但我不确定这是否与本案例相关。

关于java - 远程 MYSQL 数据库访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1700518/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com