Mysql – How to use a MySQL database both remotely and locally

data synchronizationmulti-masterMySQLphpmyadmin

I cannot find the best solution for my problem.

I made a C++ application which runs on a Kiosk under Ubuntu that needs to store and retrieve data from a MySQL database and these same data need to be accessed from a remote web application.

These are the requirements:

  • The kiosk is connected to Internet, but we cannot assume that internet is always available
  • The kiosk need to always access to database because the users can access the kiosk services only after the login (user data are stored in the database)
  • the remote web application needs to insert or modify data stored in the database

At the moment, I'm using a local MySQL database installed in the Kiosk with PhpMyAdmin and the application directly access the local data. Then, I used cron to upload the database once a day, then I import the database on my server in order to be accessed by the remote web application.

This is really a bad solution, so I would like to find another one.
What do you suggest?

I would like to have a database on my server and let the remote web application directly use it and receive updates from the Kiosk.

Best Answer

Remote access can be had if you provide suitable GRANTs for hosts other than "localhost".