3
votes

I have setup a mysql database on a linux server on Amazon's EC2. This works well locally. I can log into the linux box and administer the mysql database

I am trying to connect my local GUI client to the remote mysql and it is failing to connect.

I updated the /etc/mysql/my.cnf file and changed the following:

skip-networking
bind-address            = 0.0.0.0

I am still not able to connect. Any thoughts?

EDIT: I first tried bind-address=0.0.0.0 , then I added skip-networking with bind-address

EDIT #2: I made sure the security group opens on 3306. I also have other ports open which work so I dont think its an amazon specific issue

1
skip-networking will disable TCP connection support. You'll be limited to connecting via UNIX-domain sockets only. The bind-address will be useless as well, since TCP isn't enabled. - Marc B
I had a similar problem and i had created the instance in one region and then tried to connect in another and it failed - PurplePilot
Did you check security group? Open the port 3306 and allow your IP. - Rodney Quillo
Yes. I checked the security group - Tihom
@PurplePilot: How did you work around the issue? - Tihom

1 Answers

2
votes

I generally don't recommend you to open port 3306 for public access (or even with IP restrictions). I personally always tunnel port 3306 with Putty/ssh and then just use localhost to connect to the database.

In this case don't forget to grant privileges for the user like this:

grant all privileges on yourDatabaseName.* to 'yourUserName'@'localhost' identified by "yourUsersPassword";

If you still want to make direct connection, it's possible, that your user still don't have enough privileges. You can try this:

grant all privileges on yourDatabaseName.* to 'yourUserName'@'yourClientsIp' identified by "yourUsersPassword";