Allow remote access to MYSQL database

To allow remote access to MySql first create a MySql user and assign host as %.

CREATE USER 'newuser'@'%' IDENTIFIED BY 'password';

then grant privileges

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'%';

then flush privileges

FLUSH PRIVILEGES;

You may need to add the following to /etc/mysql/my.cnf to listen for all ip’s instead of just localhost, this will override the setting bind-address = 127.0.0.1

[mysqld]
bind-address = 0.0.0.0

You may also need to allow TCP port 3306 for incoming connections in your firewall for MySql.

Leave a Reply

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