How I make a local MySQL database update a mirror on internet all the time it is possible?
3 Answers
You'll need to setup MySQL replication. You can find thorough docs here:
http://dev.mysql.com/doc/refman/5.0/en/replication.html
I agree with Craig, but I've had issues with MySQL and SSL over the Internet. I've actually used SSH tunnels instead and they've worked remarkably well. I use a wrapper called autossh (http://www.harding.motd.ca/autossh/) to manage the connections if they die.
If you're interested, here's the command I've used (note you only need to set it up on one end of the tunnel since this connection creates a bi-directional communication channel):
# /usr/bin/ssh -2 -N -o ServerAliveInterval=15 -i /root/.ssh/id_rsa -N -R \
13306:127.0.0.1:3306 -L 13306:127.0.0.1:3306 root@<REMOTEIP>
What this does is create a tunnel on port 13306 on both ends to the MySQL instance running on the other side. To setup replication, you point the "master" server to 127.0.0.1 on port 13306. To wrap it with autossh, use this command:
# /usr/local/bin/autossh -2 -fN -M 20000 -o ServerAliveInterval=15\
-i /root/.ssh/id_rsa -N -R 13306:127.0.0.1:3306 -L 13306:127.0.0.1:3306 root@<REMOTEIP>
Good Luck!

- 3,117
- 20
- 17
You can set up MySQL to perform replication over SSL. We replicate one our servers from the midwest to the west coast over SSL, 150K+ records/day without problem. But, it requires access to the configuration of the slave server (the mirror in your question).

- 1,354
- 6
- 14