We have a MySQL database server which is running on a Amazon Linux Instance which we would like to connect to remotely.

We have set the access for the port 3306 for our LAN gate way IP in the AWS security group.

We have executed the following command to grant access to our IP from where we will connect the database and the output as follows

GRANT ALL PRIVILEGES ON *.* TO 'root'@'our IP Address' IDENTIFIED BY 'password';

Query OK, 0 rows affected (0.00 sec)

Still we are getting the following error message while trying to connect the database using MySQL administrator tool:

Host: Our IP address where MySQL server runs
User : root
Password: Our password
MySQL Error: Could not connect to the specified instance.
MySQL error number 2003
Can't connect to MySQL server on 'MySQL server IP Address'(10060)

How could we solved this problem?


  • Sometime, 'flush privileges;' help a lot, after adding your user... (depends on the version of MySQL). Otherwise, i'd say you forgot the security group modification. – CloudWeavers Apr 8 '13 at 21:52

You need to identify the source of your problem.

  • First: check whether the problem comes from the network connexion. Try to ping the IP or the domain:

    $ ping $YOUR_IP
  • Second: check your identifiers by a direct connexion. Your error may result in a misconfiguration:

    $ mysql -h $YOUR_IP -P 3306 -u root -p

    You should see a prompt.

If the two tests above succeed, you should check your application configuration file.

Note: It's not a good practice to use the root user for remote access, you should create a new user (specific to your need) with limited rights.


You also need to make sure that the firewall (iptables) is not blocking access.


Possible areas to check:

  • Firewalls: Double check that port 3306 is open (at least to your IP address) in both your EC2 security group and your servers firewall (iptables, ufw etc).

  • MySQL Config: Check that MySQL server is configured (my.cnf) to listen on a TCP port, as opposed to a UNIX socket. E.g.

    port = 3306
    bind-address =

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.