Allow remote MySQL connections

MySQL default installation only allows connections from localhost. In order to work from your client machine and avoiding setup of an ssh tunnel to the server, you can modify the MySQL configuration to allow remote connections.

1. Open file /var/mysql/my.cnf. The default value for bind-address is 127.0.0.1 meaning localhost. Change it to 0.0.0.0 which allows connections from all IP addresses.

2. Grand user access to the database to connect from any host by executing this sql statement on the mysql database.

GRANT ALL ON database_name.* TO root@'%' IDENTIFIED BY 'root_password';

3. Restart mysql server process

Advertisements

One thought on “Allow remote MySQL connections

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s