Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试连接到mysql并获取错误:不允许连接到此mysql服务器连接被外部主机关闭_Mysql - Fatal编程技术网

尝试连接到mysql并获取错误:不允许连接到此mysql服务器连接被外部主机关闭

尝试连接到mysql并获取错误:不允许连接到此mysql服务器连接被外部主机关闭,mysql,Mysql,嗨,我正在ec2中运行两个rhel实例。 现在我正试着去做 $telnet ec2-184-73-58-163.compute-1.amazonaws.com 3306 Trying 10.193.139.147... Connected to ec2-184-73-58-163.compute-1.amazonaws.com. Escape character is '^]'. bHost 'domU-12-31-39-05-3D-E6.compute-1.internal' is not a

嗨,我正在ec2中运行两个rhel实例。 现在我正试着去做 $telnet ec2-184-73-58-163.compute-1.amazonaws.com 3306

Trying 10.193.139.147...
Connected to ec2-184-73-58-163.compute-1.amazonaws.com.
Escape character is '^]'.
bHost 'domU-12-31-39-05-3D-E6.compute-1.internal' is not allowed to connect to this MySQL serverConnection closed by foreign host.
我是个新手。现在不知道该怎么办?
请帮忙。

我在这方面也不是很好,但我认为这个链接可以帮你一点忙。 这是我在使用MySQL时遇到的问题

试试看。我希望它能起作用。

如果您不是MySQL用户权限表中的白名单,则无法连接到远程MySQL


假设您的IP地址是
199.255.209.168
,您正试图使用用户名
rakman
和一些密码登录在IP地址
123.238.18.47
运行的MySQL守护进程

$ mysql -h 123.238.18.47 -u rakman -p
Enter password:
ERROR 1130 (HY000): Host '199.255.209.168' is not allowed to connect to this MySQL server
mysql用户[rakman]@[您的IP地址]需要以运行于
123.238.18.47
的mysql的用户权限存在。所以
rakman@199.255.209.168
(或
rakman@%
允许从任何远程主机登录此MySQL,但不推荐使用)需要在运行于
123.238.18.47的MySQL的用户权限中显示

关于如何实现这一点的MySQL命令,您可以在上看到接受的答案。如果你在那之后尝试登录

$ mysql -h 123.238.18.47 -u rakman -p
Enter password:
Welcome to the MySQL monitor.

您必须授予mysql的访问权限

要创建新用户,请执行以下操作:

CREATE USER 'myuser'@'youripaddres' IDENTIFIED BY 'password';
对于所有IP,请在下面使用

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'youripaddres' WITH GRANT OPTION;
用于以下特定ip用途

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'youripaddres' WITH GRANT OPTION;
p、 s.
flush特权是使更改生效所必需的。

的可能副本