Remote access to Mysql database

Asked

Viewed 962 times

6

I have a BD within a corporate network on a local machine serving as a Mysql server.

The structure of the network works like this!

inserir a descrição da imagem aqui

I need to access for example the machine that is marked red, and in this environment the "Server" has its static IP "10.10.10.10", and the machine marked "192.168.0.34".

Could someone help me how to get access to this Mysql server?

  • You need to make a rule on the server...that does the nateamento of the band 10.10.10.x to 192.168.0.x in the firewall or some rule that does the redirecting of a connection on the port of mysql on the server to the target computer, you also need to make a configuration in apache to accept this connection.

  • Would you have any material to help you do this mapping? I made some commands there on the server... " C: netsh interface portproxy add v4tov4 listenaddress=179.111.X. X listenport=3306 connectport=3306 connectaddress=192.168.X. X", then I tried the connection but it didn’t work.

  • in the question does not say anything about what difficulty you are having. It gives some error when trying to connect?

  • Yes error that appears is, ERROR 2003 (HY000): Can’t connect to Mysql server on 'IP SERVER' (10060).

  • Tried to do what I described in my reply? -> Create a user with permission to access Mysql from another IP.

  • I used the command to access Mysql, mysql -uroot -p<password> -h<ipdoservidor>. I created the user with access to everything, I left with the "%" and even so when I try to access the message I mentioned above.

Show 1 more comment

1 answer

1


Your question is related to networks, looking at your figure you have a server at the tip, surely you are performing NAT of your internal network ips so that all your internal computers can make access to the Internet.

Your Server has two interfaces, one that goes out to the internet and the other that should serve as gateway to the computers of the network 192.168.0.0/24, It happens that the static IP that is in its wan interface (10.10.10.10) is not a public IP so it is very likely to have a router on the other end, to make it work properly I recommend that this router is in bridge mode, this will deliver a public IP (static or not, depends on the contract of your link) directly on your server’s wan interface!

With this step completed you must make a rule of redirection in your firewall, this rule will open in the Wan interface the port of your Mysql and redirect the connection to the machine that has mysql running in your internal network.

This way when someone makes an access from outside your network to the public IP of your link on the specific port the connection will be redirected to the internal IP on the specific port.

(user on the internet) ----> (connection to the Public IP and mysql port of your link) ---> (forwarding to the IP and PC port on your internal network)

  • So... I even use some coias for external access, I made a firewall redirect configuration and even so when having access me from closed port error. I believe there’s some problem with the firewall.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.