Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sequelize.js - You need to install mysql package manually

After installing node.js and sequelize.js, and running a basic test, the message "You need to install mysql package manually" is displayed.

I've tried searching the web and Stackoverflow for the cause of this message.

I have installed:

  • mysql server version 5.5.31-0ubuntu0.13.04.1
  • node v0.10.5
  • sequelize.js v1.6.0
like image 312
thaspius Avatar asked Jul 16 '13 03:07

thaspius


People also ask

Does Sequelize work with MySQL?

Sequelize is a Node. js-based Object Relational Mapper that makes it easy to work with MySQL, MariaDB, SQLite, PostgreSQL databases, and more.

Does Sequelize need MySQL2?

MySQL2 is the MySQL connector library used by Sequelize to connect to the MySQL db server. The DB wrapper uses mysql2 directly to connect to MySQL and create the database if it doesn't exist. For more info on MySQL2 see https://github.com/sidorares/node-mysql2.

What is node Sequelize JS?

Sequelize is an easy-to-use and promise-based Node. js ORM tool for Postgres, MySQL, MariaDB, SQLite, DB2, Microsoft SQL Server, and Snowflake. It features solid transaction support, relations, eager and lazy loading, read replication and more.


3 Answers

You need to install the mysql npm module:

npm install mysql

The reason sequelize doesn't have the mysql module as its own dependency is because it can be used with other databases such as postgres or sqlite.

like image 86
go-oleg Avatar answered Oct 19 '22 10:10

go-oleg


Install mysql globally:

npm install -g mysql
like image 20
Svagis Avatar answered Oct 19 '22 10:10

Svagis


For 2017+ users who are using mysql2, the mysql requirement was part of Sequelize v3.

Install v4 of Sequelize (ie. npm i [email protected] --save) and it will work properly with mysql2.

For more info, see this issue in the github repo.

like image 9
James Gentes Avatar answered Oct 19 '22 10:10

James Gentes