Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

Thanks!

share|improve this question
    
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

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer

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

share|improve this answer

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.

    [mysqld]
    port = 3306
    bind-address = 0.0.0.0
    #skip-networking
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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