Mysql synchronizes two tables from 2 databases

I have a request. I have two tables on two different servers. Both tables have the same structure. The main table on one server is updated daily, so I want the cron job or the PHP cron script to update the second worksheet on another server. I saw a lot of scripts, but no one allowed my requirements.

+5
source share
2 answers

I can’t believe that you did not find a suitable script for this. Depending on the bandwidth between the server and the server and the size of the table data, you can:

  • direct transfer of the entire table:

    mysqldump [options] sourcedatabase tablename \
      | mysql [options] --host remoteserver --user username ...
    
  • migrate table using MySQL compression

    # same as above, mysql has the "-C" flag
    
  • transmission using SSH encryption and compression; mysql runs remotely

    mysqldump [options] sourcedatabase tablename \
      | ssh -C user@remoteserver 'mysql [options]'
    
  • SQL rsync

    mysqldump [options] sourcedb tbl > dump.sql
    rsync [-z] dump.sql user@remoteserver:/path/to/remote/dump.sql
    ssh user@remoteserver "mysql [options] < /path/to/remote/dump.sql"
    

, LOST . Mysqldump-plus-rsync-plus-ssh , , , 10- SQL- INSERTS, SQL.

, MySQL, , . , . " " " " .

+7

- dbForge Studio MySQL.

  • , MySQL.
  • , ( *.dcomp).
+1

All Articles