无法从 Windows GUI 工具连接到远程 Linux 服务器上的 MySql 数据库

发布于 2024-10-11 23:32:09 字数 441 浏览 1 评论 0原文

我已经在 Amazon EC2 上的 Linux 服务器上设置了 mysql 数据库。这在本地效果很好。我可以登录 linux 盒子并管理 mysql 数据库

我正在尝试将本地 GUI 客户端连接到远程 mysql,但连接失败。

我更新了 /etc/mysql/my.cnf 文件并更改了以下内容:

skip-networking
bind-address            = 0.0.0.0

我仍然无法连接。有什么想法吗?

编辑:我首先尝试了bind-address=0.0.0.0,然后我添加了带有bind-address的skip-networking

编辑#2:我确保安全组在3306上打开我还打开了其他可用的端口,所以我认为这不是亚马逊特定的问题。

I have setup a mysql database on a linux server on Amazon's EC2. This works well locally. I can log into the linux box and administer the mysql database

I am trying to connect my local GUI client to the remote mysql and it is failing to connect.

I updated the /etc/mysql/my.cnf file and changed the following:

skip-networking
bind-address            = 0.0.0.0

I am still not able to connect. Any thoughts?

EDIT: I first tried bind-address=0.0.0.0 , then I added skip-networking with bind-address

EDIT #2: I made sure the security group opens on 3306. I also have other ports open which work so I dont think its an amazon specific issue

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

各空 2024-10-18 23:32:09

我一般不建议您打开端口 3306 进行公共访问(甚至 IP 限制)。我个人总是使用 Putty/ssh 隧道端口 3306,然后使用 localhost 连接到数据库。

在这种情况下,不要忘记像这样为用户授予权限:

grant all privileges on yourDatabaseName.* to 'yourUserName'@'localhost' identified by "yourUsersPassword";

如果您仍然想进行直接连接,则可能是您的用户仍然没有足够的权限。你可以试试这个:

grant all privileges on yourDatabaseName.* to 'yourUserName'@'yourClientsIp' identified by "yourUsersPassword";

I generally don't recommend you to open port 3306 for public access (or even with IP restrictions). I personally always tunnel port 3306 with Putty/ssh and then just use localhost to connect to the database.

In this case don't forget to grant privileges for the user like this:

grant all privileges on yourDatabaseName.* to 'yourUserName'@'localhost' identified by "yourUsersPassword";

If you still want to make direct connection, it's possible, that your user still don't have enough privileges. You can try this:

grant all privileges on yourDatabaseName.* to 'yourUserName'@'yourClientsIp' identified by "yourUsersPassword";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文