23

Hi i am running two rhel instances in ec2. now i am trying to do $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.

I am a newbie. not getting what to do now? Please help.

Maverick
  • 1,952
  • 4
  • 21
  • 33
  • possible duplicate of [Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server](http://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server) – Harikrishnan May 06 '15 at 04:15

3 Answers3

27

You cannot connect to the remote MySQL if you are not white listed in the MySQL user privileges table.


Let's assume your IP address is 199.255.209.168 and you are trying to log into the MySQL daemon running at IP address 123.238.18.47 by the username rakman with some password

$ 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

A mysql user [rakman]@[your IP address] needs to be present in the user privileges of MySQL running at 123.238.18.47. So rakman@199.255.209.168 (or rakman@% which will allow logging in to this MySQL from ANY remote host but is not recommended) needs to be present in the user privileges of MySQL running at 123.238.18.47.

For the MySQL commands on how to achieve this, you can see the accepted answer at Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server. If you try to login after that.

$ mysql -h 123.238.18.47 -u rakman -p
Enter password:
Welcome to the MySQL monitor.
Community
  • 1
  • 1
Rakib
  • 12,376
  • 16
  • 77
  • 113
18

You have to give access permission on mysql .

To create a new user:

CREATE USER 'myuser'@'youripaddres' IDENTIFIED BY 'password';

for all ips use below

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

for particular ip use below

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

p.s. flush privileges; is needed to take changes into effect.

T.Todua
  • 53,146
  • 19
  • 236
  • 237
Bipin
  • 181
  • 1
  • 2
2

I am also not that good in this area but i think this link can help you a little. This was my reference when i was having trouble with MySQL.

just try. I hope it works. SourceForge.net

James
  • 652
  • 5
  • 6