简体   繁体   English

MySQL是否接受具有绑定地址的本地,本地网络和外部连接?

[英]MySQL accepting local, local network and external connections with bind-address?

I'd like to access MySQL internally (localhost), externally (from the machine's external ip), as well as by it's local network address. 我想内部(本地主机),外部(从计算机的外部IP)以及它的本地网络地址访问MySQL。 The idea is that requests from our webserver, which is also apart of the same network, won't have to leave the local network and come back in. 这个想法是,来自我们的网络服务器(也是同一网络的一部分)的请求将不必离开本地网络再返回。

The problem I have is getting MySQL to accept requests to it's local address, as mf.cnf has the "bind-address" option set as the machine's external ip. 我遇到的问题是让MySQL接受对其本地地址的请求,因为mf.cnf的“ bind-address”选项设置为计算机的外部ip。

I've read that setting bind-address 0.0.0.0 as an option, but is that the most ideal approach? 我读过将绑定地址0.0.0.0设置为选项,但这是最理想的方法吗? I would probably need to setup iptables to drop any requests to mysql/3306 that don't come from my approved ip's. 我可能需要设置iptables,以删除对mysql / 3306的请求,这些请求都不来自我批准的ip。

That said, a tracert from the web server machine to mysql machine's external ip is only two hops, is it even worth it? 就是说,从Web服务器计算机到mysql计算机的外部ip的Tracert只有两跳,这是否值得?

As I understand, you just need to accept MySQL connections from all "directions"? 据我了解,您只需要接受所有“方向”上的MySQL连接? bind 0.0.0.0:3306 would be enough. bind 0.0.0.0:3306就足够了。 Why do you want to use iptables? 为什么要使用iptables?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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