# sails-mysql2

> MySQL and MariaDB adapter for Sails.js

Latest version **0.9.32** (published 2017-10-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install sails-mysql2
pnpm add sails-mysql2
yarn add sails-mysql2
bun add sails-mysql2
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.32 |
| Published | 2017-10-09 |
| First published | 2017-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+10 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pawan Pawar |
| Maintainers | pawanpawar |
| Keywords | mysql, mysql2, orm, waterline, sails, sails-mysql2 |

## Links

- npm: https://www.npmjs.com/package/sails-mysql2
- Repository: https://github.com/PawarPawan/sails-mysql2
- Homepage: https://github.com/PawarPawan/sails-mysql2#readme
- Issues: https://github.com/PawarPawan/sails-mysql2/issues
- npm.io page: https://npm.io/package/sails-mysql2

## Dependencies (4)

- [async](https://npm.io/package/async.md) ~0.2.10
- [mysql2](https://npm.io/package/mysql2.md) ~1.2.0
- [underscore](https://npm.io/package/underscore.md) ~1.6.0
- [underscore.string](https://npm.io/package/underscore.string.md) ~2.3.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.9.32 (latest) — 2017-10-09
- 0.9.31 — 2017-09-09
- 0.9.30 — 2017-09-09
- 0.9.29 — 2017-09-09
- 0.9.2-9.0.5 — 2017-09-09
- 0.9.2-9.0.4 — 2017-09-09
- 0.9.2-9.0.3 — 2017-09-09
- 0.9.2-9.0.2 — 2017-09-09
- 0.9.2-9.0.1 — 2017-09-09
- 0.9.28 — 2017-09-09
- 0.9.27 — 2017-09-09
- 0.9.26 — 2017-09-09
- 0.9.25 — 2017-09-09
- 0.9.24 — 2017-09-09
- 0.9.23 — 2017-09-09
- … 15 more at https://npm.io/package/sails-mysql2/versions

## README

## Installation

Install from NPM.

```bash
# In your app:
$ npm install sails-mysql2
```

## Sails Configuration

Add the mysql config to the config/connections.js file. Basic options:

```javascript
module.exports.connections = {
  mysql: {
    adapter   : 'sails-mysql2',
    host      : 'localhost',
    port      : 3306,
    user      : 'username',
    password  : 'password',
    database  : 'MySQL Database Name'

    // OR (explicit sets take precedence)
    adapter   : 'sails-mysql',
    url       : 'mysql2://USER:PASSWORD@HOST:PORT/DATABASENAME'

    // Optional
    charset   : 'utf8',
    collation : 'utf8_swedish_ci'
  }
};
```

And then change default model configuration to the config/models.js:

```javascript
module.exports.models = {
  connection: 'mysql'
};
```

## Run tests

You can set environment variables to override the default database config for the tests, e.g.:

```sh
$ WATERLINE_ADAPTER_TESTS_PASSWORD=yourpass npm test
```


Default settings are:

```javascript
{
  host: process.env.WATERLINE_ADAPTER_TESTS_HOST || 'localhost',
  port: process.env.WATERLINE_ADAPTER_TESTS_PORT || 3306,
  user: process.env.WATERLINE_ADAPTER_TESTS_USER || 'root',
  password: process.env.WATERLINE_ADAPTER_TESTS_PASSWORD || '',
  database: process.env.WATERLINE_ADAPTER_TESTS_DATABASE || 'sails_mysql',
  pool: true,
  connectionLimit: 10,
  waitForConnections: true
}
``

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