# wi-sqldump

> Create a DUMP from MySQL

Latest version **1.4.6** (published 2018-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install wi-sqldump
pnpm add wi-sqldump
yarn add wi-sqldump
bun add wi-sqldump
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.6 |
| Published | 2018-03-12 |
| First published | 2018-03-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andre Caetano |
| Maintainers | hoangbduet |
| Keywords | backup, mysql, mysql-dump, dump, restore, database, backup, database |

## Links

- npm: https://www.npmjs.com/package/wi-sqldump
- Repository: https://github.com/hoangbduet/wi-sqldump
- Homepage: https://github.com/hoangbduet/wi-sqldump.git
- Issues: https://github.com/hoangbduet/wi-sqldump.git
- npm.io page: https://npm.io/package/wi-sqldump

## Dependencies (3)

- [async](https://npm.io/package/async.md) ^1.4.2
- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [mq-node](https://npm.io/package/mq-node.md) ^1.0.7

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 1.4.6 (latest) — 2018-03-12
- 1.4.5 — 2018-03-12
- 1.4.4 — 2018-03-12
- 1.4.3 — 2018-03-12

## README

# Mysql Dump

This repo is 100% clone from https://github.com/webcaetano/mysqldump.git

Create a backup from MySQL

## Installation

```
npm install wi-sqldump
```

Example 
```javascript
var mysqlDump = require('wi-sqldump');

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

Full Options Example :

```javascript
var mysqlDump = require('wi-sqldump');

mysqlDump({
	host: 'localhost',
	user: 'root',
	password: '',
	database: 'test',
	tables:['players'], // only these tables
	where: {'players': 'id < 1000'}, // Only test players with id < 1000
	ifNotExist:true, // Create table if not exist
	disableForeignKeyChecks: true, //Adds SET foreign_key_checks = 0; at the file begin
	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 for ALL tables `Default: true`;

#### where
Type: `Object`

Where clauses to limit dumped data `Example: where: {'users': 'id < 1000'}`

Combine with `data: false` to only dump tables with where clauses  `Default: null`;

#### ifNotExist 

Type: `Boolean`

Create tables if not exist method `Default: true`;

#### dropTable 

Type: `Boolean`

Drop tables if exist `Default: false`;

#### disableForeignKeyChecks 

Type: `Boolean`

Adds SET foreign_key_checks = 0; at the begin of the generated file `Default: false`;

#### 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.

---
_Source: https://npm.io/package/wi-sqldump · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
