Sequelize error with MariaDB

Viewed 7620

I am trying to setup sequelize as ORM for my MariaDB.

Here is my setup:

var sequelize = require('sequelize');

var db= new sequelize('dbname', 'user', 'pass', {
  dialect: 'mariadb'
});

When I run my app I get the following error :

/my/path/to/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:23
    throw new Error('Please install mysql package manually');
    ^

Error: Please install mysql package manually

Why is sequelize trying to connect to mysql rather than mariadb as I specified in the dialect directive? Am I missing something?

4 Answers

Sequelize now has the dialect mariadb, do not use mysql

npm install --save mariadb
npm install --save sequelize

Sequelize connection code...

var sequelize = new Sequelize('database', 'username', 'password', {
  dialect: 'mariadb'
})

What the previous answer fails to mention is you must also set the dialect to MySQL...dialect: mysql because dialect: mariadb does not exist.

You must install mysql or any dialect using -g.

npm i -g mysql
Related