skip to Main Content

I am trying to connect to my apache server remotly. 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

I have tried to set the bind address in apache but that breaks my server and i need to reinstall it every time. I have also added full privilages to my user and can access it using a separate 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:xamppmysqldataibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-07-03 18:55:56 0 [Note] InnoDB: File 'C:xamppmysqldataibtmp1' 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:xamppmysqldataib_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

2

Answers


  1. Chosen as BEST ANSWER

    I found the answer

    • First you need to create a user with all privilages that can connect to any host aka root@%.
    • Then you need to open port 3306 on your router and send all the traffic to your machine that has the server.
    • Aside from that password is mandatory, to be secure

  2. You allowed remote access for your Apache server but not for the MySQL server. To allow remote access for MySQL you need to modify the 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search