How to connect mysql user to an AWS server?

0

I am using AWS and I have just installed mysql in an EC2 environment with ubuntu 14, I have created my root user with which I can connect via SSH normally, but I have created another user with grant all privileges so that another person can upload changes to a BD and I tried to connect through a standard mode with the public dns of my EC2 but it rejects me. What am I doing wrong ?, I need to configure something? ... I have opened the respective port 3306 in my security group assigned to my EC2. I hope you can help me

    
asked by Oscar E. Alvarado 02.09.2016 в 19:25
source

2 answers

1

It looks like you have not changed the default listening address of your MySQL, see your my.cnf to see if it has the following value:

bind-address = 127.0.0.1

If you have it, comment it and restart.

Another Solution, SSH Tunneling: Something you can do to connect remotely to a MySQL server without having to open any port, is to use an SSH tunnel.

Something like that in Linux:

ssh -fNg -L 9999:127.0.0.1:3306 [email protected]

This will enable port 9999 on your local machine as a "tunnel" to the local remote 3306 port of your server.

For Windows, maybe using Putty you can get it tb:

Take a look at this: link

Most graphic clients for MySQL allow connections through tunneling, such as MySQL WorkBench.

link

    
answered by 07.09.2016 / 16:35
source
2

You have to have these considerations:

  • Add an input rule in your security group from your instance EC2 to port 3306
  • Make sure that in the my.conf file of mysql you have the bind-address parameter in 0.0.0.0 (listen to all the ip addresses)
  • If you did the previous point, restart the mysql service (# service mysqld restart)
  • Create a mysql user "create user [name] @ '%' ... the% is important because it indicates that the user can access from any IP address

With all the above you should not have problems, in point 2 you can do a

$ telnet [dirección ip] 3306 

to check if the port is listening remotely

    
answered by 03.09.2016 в 00:45