Accessing MySQL databases from remote computer

Author: | Categories: Database, Linux No Comments

To expose MySQL other than localhost uncomment following line in
/etc/mysql/my.cnf
and assign to your computers IP address and not loopback


bind-address = xxx.xxx.xxx.xxx
# replace xxx with IP


Next for a remote user to connect with the correct privileges you need to have that user created in both the localhost and '%' as in.


CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';


then


GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';

Leave a Reply

Your email address will not be published.