MySQL : Allow remote connections

In order to allow remote SQL connections from any IP address, the following changes need to be made:
1. Locate the my.cnf file using the command

$ locate my.cnf
/etc/opt/mysql/my.cnf

2. Modify the bind-address and change it from localhost to all IP’s

# bind only to localhost
#bind-address = 127.0.0.1
bind-address = 0.0.0.0

3. Disable skip-networking in my.cnf

#skip-networking

4. Grant remote access the root user from any ip (or specify your ip instead of %)

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'
    IDENTIFIED BY 'your_root_password'
    WITH GRANT OPTION;
FLUSH PRIVILEGES;

5. Restart mysql services

service mysql restart
Advertisements

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