2012-06-20 43 views
5

您好我在ec2中運行兩個rhel實例。 現在我要做的 $遠程登錄ec2-184-73-58-163.compute-1.amazonaws.com 3306試圖連接到MySQL,並獲得錯誤:不允許連接到此MySQL服務器連接關閉由外國主機

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. 

我是一個新手。不知道現在該做什麼? 請幫忙。

+0

PO可以複製[Host'xxx.xx.xxx.xxx'不允許連接到這個MySQL服務器](http://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not -allowed到連接到這個MySQL的服務器) – Harikrishnan

回答

10

如果您未在MySQL用戶權限表中列出白名單,則無法連接到遠程MySQL。


讓我們假設你的IP地址是199.255.209.168和您嘗試登錄到IP地址爲123.238.18.47通過用戶名rakman與一些密碼

$ 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]運行MySQL守護進程@ [您的IP地址]需要以在123.238.18.47上運行的MySQL的用戶權限存在。因此[email protected](或[email protected]%將允許從任何遠程主機登錄到此MySQL,但不建議使用)需要存在於運行於123.238.18.47的MySQL的用戶權限中。

有關如何實現此目的的MySQL命令,您可以在Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server處看到接受的答案。如果你嘗試登錄後。

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

我在這方面也不太好,但我認爲這個鏈接可以幫助你一點。 這是我在使用MySQL時遇到的問題。

只是試試。我希望它能起作用。 SourceForge.net

5

你必須給訪問權限mysql的

所有IPS使用下面

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' WITH GRANT OPTION; 

特定的IP使用下面

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'youripaddres' WITH GRANT OPTION; 

感謝 比拼Bahuguna

相關問題