loopback-connector-mysql is the MySQL connector module for loopback-datasource-juggler.
For complete documentation, see StrongLoop Documentation | MySQL Connector.
npm install loopback-connector-mysql --saveTo use it you need loopback-datasource-juggler.
-
Setup dependencies in
package.json:{ ... "dependencies": { "loopback-datasource-juggler": "latest", "loopback-connector-mysql": "latest" }, ... } -
Use:
var DataSource = require('loopback-datasource-juggler').DataSource; var dataSource = new DataSource('mysql', { host: 'localhost', port: 3306, database: 'mydb', username: 'myuser', password: 'mypass' });
You can optionally pass a few additional parameters supported by
node-mysql, most particularlypasswordandcollation.Collationcurrently defaults toutf8_general_ci. Thecollationvalue will also be used to derive the connection charset.
The tests in this repository are mainly integration tests, meaning you will need to run them using our preconfigured test server.
- Ask a core developer for instructions on how to set up test server credentials on your machine
npm test