# pouchdb-adapter-mysql

> LevelDOWN Adapter for running pouchdb and pouchdb server using an mysql backend.

Latest version **8.0.1** (published 2018-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install pouchdb-adapter-mysql
pnpm add pouchdb-adapter-mysql
yarn add pouchdb-adapter-mysql
bun add pouchdb-adapter-mysql
```

## 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 | 8.0.1 |
| Published | 2018-06-12 |
| First published | 2018-01-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 53.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tom |
| Maintainers | twilson63 |

## Links

- npm: https://www.npmjs.com/package/pouchdb-adapter-mysql
- npm.io page: https://npm.io/package/pouchdb-adapter-mysql

## Dependencies (3)

- [pouchdb-core](https://npm.io/package/pouchdb-core.md) ^6.4.1
- [@twilson63/mysql-down](https://npm.io/package/@twilson63/mysql-down.md) ^1.1.4
- [pouchdb-adapter-leveldb-core](https://npm.io/package/pouchdb-adapter-leveldb-core.md) ^6.4.1

## Recent versions

- 8.0.1 (latest) — 2018-06-12
- 8.0.0 — 2018-06-12
- 7.0.0 — 2018-06-12
- 6.5.1 — 2018-06-11
- 6.5.0 — 2018-06-11
- 6.4.10 — 2018-05-16
- 6.4.9 — 2018-03-27
- 6.4.8 — 2018-01-23
- 6.4.7 — 2018-01-22
- 6.4.6 — 2018-01-21
- 6.4.5 — 2018-01-21
- 6.4.4 — 2018-01-20
- 6.4.3 — 2018-01-20
- 6.4.2 — 2018-01-20
- 6.4.1 — 2018-01-20
- … 1 more at https://npm.io/package/pouchdb-adapter-mysql/versions

## README

# pouchdb-adapter-mysql

LevelDOWN Adapter for running pouchdb and pouchdb server using an mysql backend.

## PouchDB Example

```js
const PouchDB = require('pouchdb-core')
PouchDB.plugin(require('pouchdb-adapter-mysql'))
const db = PouchDB('dbname', {
  adapter: 'mysql',
  prefix: {
    host: 'localhost',
    port: 3306,
    user: 'testuser',
    password: 'testpassword',
    database: 'test'
  }
})

db
  .allDocs({ include_docs: true })
  .then(res => console.log(JSON.stringify(res, null, 2)))
```

---

You can also run PouchDB Server

```js
var PouchDB = require('pouchdb')
PouchDB.plugin(require('pouchdb-adapter-mysql'))
const MPouchDB = PouchDB.defaults({
  adapter: 'mysql',
  prefix: {
    host: 'localhost',
    port: 3306,
    user: 'testuser',
    password: 'testpassword',
    database: 'test'
  }
})
var express = require('express')
var app = express()

app.use(require('express-pouchdb')(MPouchDB))
const db = MPouchDB('dbname')

app.listen(3000)
```

> CAVEAT: Assumes mysql is running locally on 3306 with no password for root

---

## How to run with Custom MySql uri

You can run with a custom mysql uri using the `MYSQL_URI` env variable containing the
custom connection info.

> URI Pattern mysql://user:pass@server:PORT/database

```
export MYSQL_URI=mysql://user:pass@server.com:3306/mydb
node server.js
```

Then you do not need a prefix, just supply the pouchdb dbName

```js
const db = PouchDB('mydb', { adapter: 'mysql' })
```

## How to run with an encrypted connection

Running an encrypted connection is all about getting the ca certificate and
supplying it as an env var

MSQL_SSL=...cert here...

## Contributing

All contributions are welcome

## License

MIT

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