Dears I am a newbie, I need help with two questions I have:
Q1\ How can I be able to submit and save collected data directly to MySQL (Self-hosted)?
Q2\ Depending on the first question if it could not be done easily, how about if I have the collected data on Ona server as an example and then how can I sync the collected data there to another self-hosted MySQL?
Thanks in advance.
Well, you can just install ODK Aggregate and set it up to use a MySQL database, which is a pretty standard configuration. Then all your submissions we get put into appropriate tables in the MySQL database. In effect ODK Aggreagte will 'save data directly to MySQL' - if you can live with the MySQL table structures that ODK uses.
You'll probably need to get ODK Aggregate to publish submissions to an appropriate webservice, which will then translate the received submission data (eg JSON) and save it into your other MySQL database. It could all be done with a pretty basic Apache setup running a PHP script that INSERTs the incoming data into your appropriate MySQL table.
By 'syncing' here I assume you really mean 'push' the data from Ono to another MySQL DB... Trying to keep the internal ODK database synced with additions made to another database is a whole different can-o-worms