[英]I can't connect to a remote db using java in netbeans and apache server
I am trying to connect to my apache server remotly. 我正在尝试远程连接到我的Apache服务器。 I manged to allow my db and server to be accessed with my ip but when i try to test the connection to my db using the integrated netbeans connection tool i can only reach it using my localhost
我设法允许使用我的IP访问数据库和服务器,但是当我尝试使用集成的netbeans连接工具测试与数据库的连接时,我只能使用本地主机访问它
I have tried to set the bind address in apache but that breaks my server and i need to reinstall it every time. 我试图在apache中设置绑定地址,但这会破坏我的服务器,并且每次都需要重新安装它。 I have also added full privilages to my user and can access it using a separate ip.
我还向用户添加了全部特权,并且可以使用单独的ip访问它。
#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Require local
Require ip xxx.xxx.xxx.xxx (my ip)
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
("jdbc:mysql://xxx.xxx.xxx.xxx:3306/dbname", "root", "password");
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 error log: 错误日志:
2019-07-03 18:55:56 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-07-03 18:55:56 0 [Note] InnoDB: Uses event mutexes
2019-07-03 18:55:56 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-07-03 18:55:56 0 [Note] InnoDB: Number of pools: 1
2019-07-03 18:55:56 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-07-03 18:55:56 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2019-07-03 18:55:56 0 [Note] InnoDB: Completed initialization of buffer pool
2019-07-03 18:55:56 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=1797710
2019-07-03 18:55:56 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-07-03 18:55:56 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-07-03 18:55:56 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-07-03 18:55:56 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-07-03 18:55:56 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2019-07-03 18:55:56 0 [Note] InnoDB: Waiting for purge to start
2019-07-03 18:55:56 0 [Note] InnoDB: 10.3.16 started; log sequence number 1797719; transaction id 225
2019-07-03 18:55:56 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
2019-07-03 18:55:56 0 [Note] InnoDB: Buffer pool(s) load completed at 190703 18:55:56
2019-07-03 18:55:56 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-07-03 18:55:56 0 [Note] Server socket created on IP: 'xxx.xxx.xxx.xxx'.
2019-07-03 18:55:56 0 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 10049: The requested address is not valid in its context.
2019-07-03 18:55:56 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2019-07-03 18:55:56 0 [ERROR] Aborting
You allowed remote access for your Apache server but not for the MySQL server. 您允许对Apache服务器进行远程访问,但不允许对MySQL服务器进行远程访问。 To allow remote access for MySQL you need to modify the
my.cnf
: 要允许MySQL的远程访问,您需要修改
my.cnf
:
[mysqld]
...
bind-address = xxx.xxx.xxx.xxx
For a detailed instruction see for example here: https://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html 有关详细说明,请参见此处的示例: https : //www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
I found the answer 我找到了答案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.