Remotely access to mySQL running on AWS

You can remotely access mysql DB running in an AWS Instance. You can access it in the terminal or in a GUI tool like mysql workbench by following these steps:

  1. Login to AWS console in your browser window.
  2. Go to EC2 -> Instances
    It will list all your instances. Click on Security group of your Instance to go to security group.
  3. Edit inbounds and make mysql Source accessible from anywhere
    remote-access-mysql
  4. Login to AWS using ssh
    Open mysql config file to change the bind address. You can find it in the file “/etc/mysql/mysql.conf.d”. If you didn’t find it in this file, check other config files.

    cd /etc/mysql/mysql.conf.d

    Find the line looks like: bind-address = 127.0.0.1
    Change it to: bind-address = 0.0.0.0
    This allows mysql to be accessible from remote locations.

  5. Restart mysql service
    sudo service mysql restart
  6. Try to login to mysql at local machine:

    mysql -u<USER_NAME> -p -h <PUBLIC_IP>

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top
Shares