I have a mysql server and wanted to grant access to some remote hosts. The server runs on RedHat Enterprise Linux.
Fir I had to make some changes to the mysql config file:
su # edit mysql config file vi /etc/my.cnf # add the following line bind-address=SERVER-IP # make sure there is line that tells mysql which port to use, something like port=3306 # and that the following line is uncommented, although I did not have this line at all in my my.cnf # skip-networking
Log on to your database an allow access from remote hosts
mysql -u root -p DB -h localhost GRANT ALL ON MY_DB.* TO 'MY_USER'@'SERVER_IP' IDENTIFIED BY 'MY_PASSWORD'; exit;
Finally check whether or not port 3306 is actually open. If its closed open it with:
su vi /etc/sysconfig/iptables # add the following line -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT # save and quit and restart iptables service iptables restart
Links I found useful: