Git Product home page Git Product logo

mysql-quick-copy's Introduction

mysql-quick-copy - A faster database copy solution

This method copies binary data files in the MySQL data directory rather than using the mysqldump tool provided.

Timing

For a 55GB database:

  • export ~2 minutes
  • import ~3 minutes

Usage

  • Export the table data to the /tmp folder.

./export.rb -d 'my_database' -u 'user' -p 'password' -o '/tmp'
./export.rb -h # for detailed information and defaults
  • Copy /tmp/my_database to the destination computer. Compressing the directory can help transfer times.

  • Import the table data

./import.rb -d 'my_database' -u 'user' -p 'password' -s '/tmp'
./import.rb -h # for detailed information and defaults

Notes

  • Script needs to be run on the server with MySQL client installed.
  • This method locks each table individually during the export process.
  • Script needs access to the MySQL datadir directory.
  • Only works with MySQL

Use cases

  • Copying databases for developers
  • Creating test databases that are expendable
  • Dumping staging data
  • Do not use in production as it locks each table ~ 1-10 seconds depending on size

TODO - open a PR :)

  • Create gem
  • Create Homebrew recipe
  • Slackbot integration

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.