Can we do mirror database?

When we have 2 DB servers like

can we make an automatic mirroring within those two databases?

I can do the php script which does the mirroring.
But how do I mirror the databases? Like every night at 3AM ? I know a cronjob of some time would be good/

Would the best way to do it is delete database and recreate it every time at 3AM?

There’s no need to delete the database; look into mysqldump and mysqlimport.

A two-line shell script that dumps one and imports it into the other, run from cron, would do the trick. PHP seems like a strange choice of languages for something like this.

If you want useful replies, ask smart questions.