简体   繁体   中英

remotely connect to mysql database over the internet

I've got a problem with database remote connection, I have 2 PCs in the same local network, say A and B, and A is running Windows 7(local ip:10.0.0.10) and it uses Virtual Box to run an Ubuntu(bridged adaptor, local ip:10.0.0.100), and mysql database resides in Ubuntu as well. I've gone through couple of tutorials in the Internet about how to create remote mysql connection.

But my problem is, I can use PC B to scan PC A's Ubuntu(10.0.0.100) port 3306, it returns the port is open, but if I scan PC A's Ubuntu port 3306 through its public IP address(public URL) by using PC B, I get the port is not open and if I try to connect to it, it gives me mysql error 10060. I'm wondering what problem would cause this? Thanks in advance :)

the easiest way to connect is through an ssh tunnel. that way as far as mysql is concerned you are connecting from localhost on the ubuntu machine so you can even connect as the mysql root account.

a lot of client tools have this connection method already built in if you dont want to get your hands dirty with the commandline.

besides all that if you really need to connect without ssh, make sure that mysql is configured to bind to all required ip addresses. from memory this is not the case out of the box.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM