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

2023-09-11 09:03:10 作者:来电显示

我已经安装在Amazon的EC2在Linux服务器上的MySQL数据库。这种运作良好,在本地。我可以登录到Linux机器和管理mysql数据库

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

我想我的本地GUI客户端连接到远程MySQL,它是无法连接。

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

我更新了/etc/mysql/my.cnf文件,并更改如下:

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?

修改:我第一次尝试绑定地址= 0.0.0.0,然后我加跳过联网使用绑定地址

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

编辑#2 :我确信安全组开上3306我也有其他的端口开放而工作,所以我不认为它是亚马逊的具体问题

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

推荐答案

我一般不建议您打开3306端口,供公众查阅(甚至有IP限制)。我个人一直隧道端口3306与腻子/ SSH,然后只用本地主机连接到数据库。

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";
 
精彩推荐