mysql错误61无法连接

wvt8vs2t  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(329)

我读了这篇文章。还有其他一些。我在ubuntu上安装了amazonec2服务器。我创建了一个mysql数据库,并试图通过mysql workbench连接到它。
使用标准的tcp/ip over ssh,我可以使用.pem密钥进行连接。
我使用workbench gui创建了一个新用户,并授予了新用户所有权限。
在amazonec2接口中,我添加了一个安全组,允许ssh和tcp都使用源代码0.0.0.0/0和:::/0。
当我通过终端ssh进入服务器时,我能够将这个用户连接到mysql mysql -uthe_new_usr -p . 我无法在mysql workbench内完成。

mysql> SELECT User, Host FROM mysql.user;
+------------------+------------------+
| User             | Host             |
+------------------+------------------+
| root             | %                |
| reporting        | %                |
| root             | 127.0.0.1        |
| root             | ::1              |
| root             | ip-123-45-67-891 |
| debian-sys-maint | localhost        |
| root             | localhost        |
+------------------+------------------+

我再次能够使用标准的tcp/ipoverssh选项进行连接,该选项使用我的.pem密钥。但是我正在尝试与新创建的用户创建一个标准的tcp/ip连接。
在连接向导上,有主机名、端口和用户名的输入:

我将hostname中的条目改为ipv4字段,以类似的数字格式显示了我的ec2示例 Jmeter 板 xx..x. . 这与我用于tcp/ip over ssh连接的主机名相同(它使用.pem密钥工作)。
我通过workbench将用户更改为与我的根用户创建新用户时设置的用户名相同。
对于港口,我试着离开,因为是3306,22和删除它。下面是我的ec2示例的安全组屏幕。

当我点击“testconnection”时,我得到消息“failed to connect to mysql at xx..x。:3306 with 使用我的新用户。无法连接到“xx..x.”(61)上的mysql服务器。
我在最上面的那篇文章里打字 netstat -tulpen 在我的远程连接中:

ubuntu@ip-xxx-xx-xx-xxx:~$ netstat -tulpen;
(No info could be read for "-p": geteuid()=1000 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          9331        -               
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      106        12552       -               
tcp6       0      0 :::22                   :::*                    LISTEN      0          9345        -               
udp        0      0 0.0.0.0:49678           0.0.0.0:*                           0          7949        -               
udp        0      0 0.0.0.0:68              0.0.0.0:*                           0          8029        -               
udp6       0      0 :::28589                :::*                                0          7950        -

我不知道下一步该去哪里?

368yc8dk

368yc8dk1#

在朋友的帮助下:
在中编辑了my.cnf文件,使绑定地址=0.0.0.0
然后不得不重启mysql sudo restart mysql 就这样了。

相关问题