Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8172143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:41:33+00:00 2026-06-06T21:41:33+00:00

I am facing a problem in accessing the mysql DB on one of my

  • 0

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 worker@’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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:41:34+00:00Added an answer on June 6, 2026 at 9:41 pm

    After posting this problem, as I was working, I realized that I wasn’t even able to ping to the EC2 server or telnet to it. So something basic had to be wrong. Finally a friend helped me out with the problem. As I had expected, the problem was very specific to EC2.

    The details are as follows:

    When we create an EC2 instance, we get an external IP address which is similar to: ec2-XX-XXX-XXX-XX.ap-southeast-1.compute.amazonaws.com

    While setting the permissions in the mysql I was granting the permissions to the above IP address, i.e.:

    GRANT ALL PRIVILEGES on . to worker@'ec2-XX-XXX-XXX-XX.ap-southeast1.compute.amazonaws.com' IDENTIFIED BY 'password';
    

    This does not work when you try to communicate to an EC2 instance from another local EC2 instance. For this, you need to provide the ‘internal ip address” of the EC2 instance, which can be found using the ip command:

    ip a:

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
    valid_lft forever preferred_lft forever
    
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 12:31:41:02:58:47 brd ff:ff:ff:ff:ff:ff
    inet **XX.XX.XX.XXX/23** brd YY.YYY.YY.YYY scope global eth0
    inet6 fe80::1031:41ff:fe02:5847/64 scope link 
    valid_lft forever preferred_lft forever
    

    To get things working correctly, you need to grant the permission to the ip address –“XX.XXX.XX.XXX/23”, and it should work. Similarly, while connecting to the “mysql” database, the hostname provided to the mysql command should also be the “internal ip address” of the host EC2 instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm facing problem when migrate my web app project from development server to live
I'm facing problem in retrieving data and images from the remote database server. I
I am facing problem to get variable from query string. I have used htaccess
I'm facing problem in showing FolderBrowserDialog instance created and called from a non-UI thread.
I am facing problem adding and deleting DataRows from a DataTable that is meant
Facing problem for generating SQL Server Query In the Following query dynamic conditions are
I am facing problem in accessing database file when I am running it on
I am facing problem in retrieving long value from PostgreSQL I use the following
I'm facing a problem accessing the address book of my iPad 2. In particular
I am facing problem in order by, I am fetching the records from SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.