Git Product home page Git Product logo

mysql-sync's Introduction

mysql-sync

Syncs two mysql databases by only inserting/deleting/updating the necessary records.

Useful in cases where mysqldump generates gigabytes of data

##Usage:

mysql-sync [source-dsn] [target-dsn] [output-option]

dsn being username:password@hostname:port/database_name

output-option verbose outputs all output of INSERTs UPDATEs etc, json provides JSON encoded output for a return value to another script otherwise a minimal table update output is the resulting output

Example: mysql-sync root:password@localhost:port/source_db root:password@localhost:port/dest_db json

If the remote mysql port is not open, tunnel it via SSH i.e ssh -L 3308:localhost:3306 -o TCPKeepAlive=no -o ServerAliveInterval=15 user@host then mysql-sync root:password@localhost:3308/voeb root:password@localhost:3306/v verbose

What the script does

  • lists all tables on the remote and local host
  • compares the checksum of each mysql table
  • syncs the tables where checksum is invalid
  • verifies the sync was successful via another checksum

The databases must have the same schema. Therefore, the script will stop if

  • the number of tables is not similar
  • the structure of a table is not similar i.e describe my_table

mysql-sync's People

Contributors

hbt avatar

Watchers

James Cloos avatar Oasis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.