MySQL Remote access

 It could be that you have not configured the Amazon Security Group assigned to your EC2 Instance to accept incoming requests on port 3306 (default port for MySQL).


If this is the case then you can easily open up the port for the security group in a few button clicks:


1) Log into you AWS Console and go to 'EC2'


2) On the left hand menu under 'Network & Security' go to 'Security Groups'


3) Check the Security Group in question


4) Click on 'Inbound tab'


5) Choose 'MYSQL' from drop down list and click 'Add Rule'


Might not be the reason but worth a go...


unable to connect to localhost mysql workbench- 

 # open mysql conf file


sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf




# replace bind-address from 127.0.0.1 to 0.0.0.0


"""




bind-address = 0.0.0.0




"""


# login to mysql


sudo mysql




# create a Database


CREATE DATABASE db_name;




# allow a full access to a specific user for a specific db


GRANT ALL ON db_name.* TO user_name@'%' IDENTIFIED BY 'user_password';


GRANT ALL PRIVILEGES ON db_name.* TO 'user'@'hostname' ; # when password is already created 




# exit mysql


exit




# open up port 3306 for every one


sudo ufw allow 3306




# restart mysql


sudo systemctl restart mysql




# check from some external client to connect to this mysql. it should be successful

Comments

Popular posts from this blog

Git commands

How to Debug Android TV App using IP