Categories
amazon-ec2 amazon-web-services mysql remote-access

1130 Host ‘amazon-ec2-ip’ is not allowed to connect to this MySQL server

I am facing a problem in accessing the mysql DB on one of my Amazon EC2 servers from another EC2 server. I read through various articles regarding providing appropriate permissions for mysql to be accessed from external IP addresses, and here are the steps that I followed:

  1. Opened port 3306 on my host EC2 instance to allow for external Mysql connection.
  2. In the file /etc/mysql/my.cnf, changed the “bind-address” from “127.0.0.1” to “0.0.0.0”.
  3. Opened mysql using root, and executed the following command:
    GRANT ALL PRIVILEGES on . to [email¬†protected]‘ec2-ip-address’ IDENTIFIED BY ‘password’;

As per all the blogs/articles that I read, this should have solved the issue, but i keep getting the following error:

1130  Host 'amazon-ec2-ip' is not allowed to connect to this MySQL server

The ip address I was providing for the EC2 instance was an elastic IP that gets generated when you create an instance. To verify whether the issue is specific to EC2, I tried executing the command “3” for a different “static ip address”. Now, this worked for me (i.e. I was able to login to the mysql host from that remote server), so it is sure that the above steps are correct.

Why is the Amazon EC2 ip address not working?