GithubHelp home page GithubHelp logo

svtter / mysqldup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fopina/mysqldup

0.0 0.0 0.0 11 KB

DUPlicate a database within the same mysql server

License: MIT License

Go 89.98% Makefile 10.02%

mysqldup's Introduction

mysqldup

DUPlicate a database within the same mysql server

Every now and then a guy needs to clone a DB to make test a batch of schema changes before running that in the real DB.

Most documentation online implies that even if you want to clone the database inside the same MySQL instance, you still have to use mysqldump, create the new DB and import that in the new DB.

That sounds quite inefficient so after checking out this guy's script, mysqldump was born.

Instalation

Use go get:

go get github.com/fopina/mysqldup

Or download a pre-built binary from releases.

Usage

$ ./mysqldup --help
Usage: ./mysqldup [OPTIONS] OLD_DB_NAME NEW_DB_NAME
  -f, --force                  drop NEW_DB_NAME if it already exists
      --help                   this screen
  -h, --hostname string        connect to host (default "127.0.0.1")
  -p, --password               use password when connecting to server (read from tty)
      --password-file string   use password when connecting to server (read from file)
  -P, --port int               port number to use for connection (default 3306)
  -u, --user string            user for login (default "root")
  -V, --version                output version information and exit

Example

$ ./mysqldup -f -h remote.mysql.local -u superuser --password-file secret_password.txt prod prod_clone
281 tables to clone
[1 / 281] cloning super_secret_passwords
[2 / 281] cloning all_customer_pii
...
[280 / 281] cloning gdpr_fines
[281 / 281] cloning customer_closure_notice

This (real life) example took 5min while mysqldump | mysql took 15min.

mysqldup's People

Contributors

fopina avatar svtter 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.