1.2.0 • Published 8 years ago

mysqldump-with-drop v1.2.0

Weekly downloads
52
License
MIT
Repository
github
Last release
8 years ago

Mysql Dump

npm version Build Status

Create a backup from MySQL

Installation

npm install mysqldump-with-drop

Example

var mysqlDump = require('mysqldump-with-drop');

mysqlDump({
	host: 'localhost',
	user: 'root',
	password: '',
	database: 'test',
	dest:'./data.sql' // destination file
},function(err){
	// create data.sql file;
})

Full Options Example :

var mysqlDump = require('mysqldump-with-drop');

mysqlDump({
	host: 'localhost',
	user: 'root',
	password: '',
	database: 'test',
	tables:['players'], // only these tables 
	ifNotExist:true, // Create table if not exist
	dest:'./data.sql' // destination file
},function(err){
	// create data.sql file;
})

Options

host

Type: String

Url to Mysql host. Default: localhost

port

Type: String

Port to Mysql host. Default: 3306

user

Type: String

The MySQL user to authenticate as.

password

Type: String

The password of that MySQL user

database

Type: String

Name of the database to dump.

tables

Type: Array

Array of tables that you want to backup.

Leave Blank for All. Default: [] ALL

schema

Type: Boolean

Output table structure Default: true;

data

Type: Boolean

Output table data Default: true;

dropTable

Type: Boolean

Add drop tables if exist at begining of create table Default: false;

ifNotExist

Type: Boolean

Create tables if not exist method Default: true;

getDump

Type: Boolean

Return dump as a raw data on callback instead of create file Default: false;

dest

Type: String

Output filename with directories Default: './data.sql';

socketPath

Type: String

Path to a unix domain socket to connect to. When used host and port are ignored.

npm


The MIT License