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:
- Login to AWS console in your browser window.
- Go to EC2 -> Instances
It will list all your instances. Click on Security group of your Instance to go to security group.
- Edit inbounds and make mysql Source accessible from anywhere
- 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.
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.
- Restart mysql service
sudo service mysql restart
- Try to login to mysql at local machine:
mysql -u<USER_NAME> -p -h <PUBLIC_IP>