Enable remote connection for MySQL, multiple connections

Posted on April 1, 2014

0


1. edit /etc/mysql/my.cnf and set bind-address to 0.0.0.0.
2. if skip-networking is present, comment it out or remove it
3. restart and test:

service mysql restart
mysql -u remote_user_on_remote_system -pPASSWORD -h remote_system_url database_name

Warning: your database security is compromised. Everyone could access it now, provided they’d know username and password. Lets limit this with firewall.

See that ufw is configured to drop everything else and add:

ufw allow from 192.168.11.22 to any port 3306

Explain why this is for multiple connections? MySQL bind-address is not possible to set to allow more than one connection. By setting that to 0.0.0.0, MySQL will allow connections from any source. Limit the access to sources you trust via firewall.

Advertisements