handbook, books, note, tutorial, troubleshooting

MYSQL Remote Access ERROR 2003 (HY000) - [SOLVED]

MYSQL Remote Access ERROR 2003 (HY000) - [SOLVED]

1- Comment bind-address in my.cnf:

$cd /etc/mysql
$sudo nano my.cnf

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = MY_IP
MY_IP can be found using ifconfig or curl -L whatismyip.org |grep blue.

2- Grant privileges:

grant all privileges on db_name.* to 'username'@'localhost' identified by 'password';

3- Set port forwarding on router (TCP and UDP, port 3306):

Configure iptables for firewall
sudo iptables -I INPUT -p udp --dport 3306 -j ACCEPT

sudo iptables -I INPUT -p tcp --dport 3306 --syn -j ACCEPT

sudo iptables-save

5- Restart mysql server:

sudo /etc/init.d/mysql restart

MYSQL Remote Access ERROR 2003 (HY000) - [SOLVED]