Enable remote MySQL/MariaDB connection

Problem: Want an outside notebook/website able to remote connect AWS server’s database.

Solution: First allow all IP to access 3306 in the security group on the AWS portal.

then change my.cnf file, add bind-address:

[mysqld]
    ...
    skip-networking
    ...
    bind-address = <some ip-address>
    ...

the ip address should be 127.0.0.1 or localhost

At last, go to the mysql command-line client by entering mysql, and enter below command to grant access for outside IP address

GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'IP' IDENTIFIED BY 'PASSWORD' with grant option;

so that specific user from specific IP can remote connect to this database.

You may also like...

Leave a Reply

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

Secured By miniOrange