MySQL - Remote database toegang

Geef remote database toegang tot een MySQL database:

Vervang x.x.x.x door het remote IP-adres.

mysql> update db set Host='x.x.x.x' where Db='database_naam';
mysql> update user set Host='x.x.x.x' where user='davidvandertuijn';

iptables (optioneel)
iptables -A INPUT -i eth0 -p tcp --dport-port 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT

# Toegang accepteren van één bepaald IP-adres:
iptables -A INPUT -i eth0 -s x.x.x.x -p tcp --dport-port 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT

# Toegang accepteren van een IP-adres uit een bepaald subnet:
iptables -A INPUT -i eth0 -s 192.168.1.0/24 -p tcp --dport-port 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT

Meer informatie: iptables