从外部主机/IP 访问 mysql 数据库?(即:mysql工作台) [英] Accessing a mysql database from external host/ip? (ie: mysql workbench)

查看:28
本文介绍了从外部主机/IP 访问 mysql 数据库?(即:mysql工作台)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 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".

我已经完成了:

  • GRANT ALL PRIVILEGES ON *.* TO mysql@x.x.x.x IDENTIFIED BY "somepass";
  • 我已经在 iptables 中打开了 3306 端口.

还有其他我遗漏的基本安全问题吗?

Is there another fundamental security issue I am missing?

推荐答案

你需要做的

GRANT ALL PRIVILEGES ON *.* TO mysql@'bla.bla.bla' ...

@ 之后的部分是连接来自的主机,因此您只允许来自本地主机的连接.您需要允许从每个必要的远程主机(或所有主机 - ...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工作台)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆