How To Enable Mysql Server Remote Access In Amazon EC2 Service?


1. First of all, create a new mysql user:

mysql -u root -p
create user 'olyanren'@'%' identified by '123456';
grant all priviliges on *.* to 'olyanren'@'%' with grant option;

Note: Change olyanren username and password 123456. Also note that don't delete single quotas.

The key point is wildcard (%). By using wildcard, we give olyanren user an access right to connect from any host.

After these steps, confirm if the new user olyanren has been created

select user, host from mysql.user;

2) Restart mysql service mysqld restart

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

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

5) Check the Security Group in question

6) Click on 'Inbound tab'

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

8) Now you can test by running following command:

echo X | telnet -e X IPADDRESSOFEC2Service 3306

© 2019 All rights reserved. Codesenior.COM