Sync MySQL database

Dear Experts,

I have question pertaining to MySQL database. I have more than one MySQL databases. One is from the web hosting service and another is from in house. I wish to communicate with the MySQL DB from web hosting service with in house. Currently I am trying to sync the online DB with in house DB with a text file. I simply use the PDO to read off the data from in house DB and convert it to text file. I upload this text file through FTP to the web hosting site and use the PDO to read of the text file and insert the data to online database. If I need the data from online, I simply reverse above process along with email notification with an attachment of the data.

 Is there a better way that I can sync the data tables from  web host service with the data tables from in house MySQL DB?  How can I accomplish this?

Here are the conditions:
1. the company can tolerate few second of database update which does not need to be up to the second but will be better if can achieve the full sync in few seconds.
2. table columns ranges from 6 to 10 and rows are between 10k to 50K of rows per table.
Who is Participating?
arnoldConnect With a Mentor Commented:
there are many options but all as pointed out depend on the access.
Are you able to establish an ssh or a VPN connection to the system where the hosted mysql is?
With ssh one can create a tunnel to the mysql instance, you can then locally access both the remote mysql and the local and perform what you need.
Ray PaseurCommented:
Are both of the data bases online at URLs that can receive GET and POST requests?  If so, you can set up a RESTful web service that can sync the data.  

How many tables are involved?
kisegiAuthor Commented:
To Ray_Paseur:

Currently there are two tables but I wish to incorporate all 10.

Currently the in house DB isn't online. We tend to keep the in house private. Is there a work around for this?
Ray PaseurConnect With a Mentor Commented:
You might consider client authentication to keep in the in-house DB private.  Nobody would be able to get to the information without the username / passphrase.  If you can put both of the data bases at URLs with PHP scripts, you will be able to have scripts that can sync the data base tables.
Daniel HelgenbergerCommented:
What about plain MySQL replication, may this be an option? This way changes from master servers would be nearly instantaneous in your in house db:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.