sumber : http://ubuntu-commands.blogspot.com/2008/11/how-do-i-enable-remote-access-tomysql.html
Intinya : Karena MySql Server menolak semua koneksi yang berasal dari dirinya sendiri yang
didefinisikan dikonfigurasi mysql sendiri /etc/mysql/my.cnf (Ubuntu 8.04).
Proses Kerja :
1. Buka File /etc/mysql/my.cnf
2. Mengganti -bind-address= 127.0.0.1 dengan bind-address= [ip-server]
3. Restart Server Mysql : /etc/init.d/mysql restart
4. Dari sisi Mysql sendiri, buat database [database] : CREATE DATABASE [database]
5. Buat user untuk mengakses database tersebut (disarankan) : GRANT ALL ON [userdatabase].* TO [database]@'%' IDENTIFIED BY 'password-user-database';
OR only allow remote connection from your web server located at 10.5.1.3:
/sbin/iptables -A INPUT -i eth0 -s 10.5.1.3 -p tcp --destination-port 3306 -j ACCEPT
OR only allow remote connection from your lan subnet 192.168.1.0/24:
/sbin/iptables -A INPUT -i eth0 -s 192.168.1.0/24 -p tcp --destination-port 3306 -j ACCEPT
A sample FreeBSD / OpenBSD pf rule ( /etc/pf.conf)
pass in on $ext_if proto tcp from any to any port 3306
OR allow only access from your web server located at 10.5.1.3:
pass in on $ext_if proto tcp from 10.5.1.3 to any port 3306 flags S/SA synproxy state
Step # 7: Test it
From remote system or your desktop type the command:
$ mysql -u webadmin h 65.55.55.2 p
Where,
* -u webadmin: webadmin is MySQL username
* -h IP or hostname: 65.55.55.2 is MySQL server IP address or hostname (FQDN)
* -p : Prompt for password
You can also use telnet to connect to port 3306 for testing purpose:$ telnet 65.55.55.2 3306