Skip to content

A node script to clone a mysql db from one place to another

Notifications You must be signed in to change notification settings

webbtj/mysql-db-clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This script clones one mysql database to another, optionally doing a find and replace on text. To use, first configure the config.json file.

There are two main objects, remote_db and local_db. Each of these have 4 required members:

  1. name (the name of the database)
  2. host (the host of the database)
  3. user (the username for the database connection)
  4. pass (the password for the database connection)

remote_db also has an optioanl sed_find member, where local_db has sed_replace. If these are both set the script will replace occurances of remote_db.sed_find with remote_db.sed_replace. Remember that this is sed, so the expressions are regex AND your are within a string, so double escaping is required (mysite.com would be mysite\\.com)

The package comes with a sample config, you'll need to rename this or make your own config.json

The intent of this is for devs who are working on a site and would normally use a remote db connection but that is too slow and the manual syncing process is too cumbersome. Setup the config and just run node clone.js and it will take care of all the leg work.

Enjoy!

About

A node script to clone a mysql db from one place to another

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published