Search code examples
node.jssequelize.jsmariadbmariasql

Sequelize error with MariaDB


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?


Solution

  • Sequelize internally uses the same library to connect with MariaDB or MySQL , take a look to the documentation http://docs.sequelizejs.com/en/latest/docs/getting-started/ specifically in the section Installation.

    To make it works you just need to install mysql package so:

    $ npm install --save mysql2