从外部主机/ ip访问mysql数据库? (即:mysql workbench) [英] Accessing a mysql database from external host/ip? (ie: mysql workbench)
问题描述
我有一个运行在x.x.x.x的mysql服务器,并且可以访问它内部没有问题(当然)。然而,当尝试连接外部,即使用mysql工作台,甚至从外部服务器,我得到错误消息主机'bla.bla.bla'不允许连接到这个MySQL服务器。
I have a mysql server running on x.x.x.x, and can access it internally no problem (of course). However when attempting to connect externally, ie using mysql workbench, or even from an external server, I get the error message "Host 'bla.bla.bla' is not allowed to connect to this MySQL server".
我已完成:
-
授予所有特权ON *。* TO mysql @ xxxx IDENTIFIED BYsomepass;
- 我在iptables中打开了端口3306。
是否还有其他基本安全性问题?
Is there another fundamental security issue I am missing?
推荐答案
您需要执行
GRANT ALL PRIVILEGES ON *.* TO mysql@'bla.bla.bla' ...
@
之后的部分是连接来自的主机,因此您只允许来自localhost的连接。您需要允许从每个远程主机访问必要的(或所有主机 - ... mysql @'%'...
- 如果适用)。
The part after the @
is the host from which the connection is coming, so you have allowed only connections coming from localhost. You need to allow access from each remote host necessary (or all hosts - ... mysql@'%' ...
- if applicable).
这篇关于从外部主机/ ip访问mysql数据库? (即:mysql workbench)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!