简体   繁体   中英

MySQL data sync between Online and localhost databases

I have localhost(master) mysql database and need to get sync with online (slave) database; ex:www.abc.com

  • currently im using manual data transferring by excel files. but this way is difficult to maintain.

any suggestion please.

thank you

You can setup master slave replication. It copied automatically from a master to a slave database. Below link will be helpful to you.

https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql

You could use following steps, everytime you need to Sync Slave with Master. Your problem seems to be more related to data move on adhoc basis.

  1. Do export full database from Master.

     mysqldump -u root-proot dbname > db_export.sql 
  2. Import the step-1 exported data into Slave.

     mysql -uUsername -pPassword dbname < db_export.sql 
  3. Perform any environment settings if needed by systematic update/delete/insert.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM