Whitelisting an IP in Linux Iptables for remote MySQL.
Open port 3306 in Linux Iptables for remote MySQL by running this in ssh.
[email protected] [~]# iptables -A INPUT -i eth0 -p tcp -m tcp –dport 3306 -j ACCEPT
In order to whitelist remote servers or your IP you would need to run this mysql command.
[email protected] [~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 85140329
Server version: 5.5.48-37.8 Percona Server (GPL), Release 37.8, Revision c8ae1b6
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> GRANT ALL PRIVILEGES ON dbname.* TO [email protected]’IP’ IDENTIFIED BY ‘password’;
Please make sure you have “skip-networking” commented in your /etc/my.cnf