我是node.js和sequelize的新手,我收到一条错误消息,也许有人可以帮我解决。问题似乎在于我的Sequelize定义的类:当我调用他们的find或findAll方法时,他们拒绝访问数据库:
shell$ node
> var Sequelize = require("sequelize");
> var sequelize = new Sequelize("myapp", "root");
> var User = sequelize.define('User', { id: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true }, email: Sequelize.STRING, password: Sequelize.STRING });
> User.find(2);
Error: deprecated: use mysql.createClient() instead
at new Client (/Users/jay/node_modules/sequelize/node_modules/mysql/lib/client.js:12:11)
at [object Object].run (/Users/jay/node_modules/sequelize/lib/sequelize/query.js:11:16)
at [object Object].query (/Users/jay/node_modules/sequelize/lib/sequelize/sequelize.js:42:52)
at [object Object].query (/Users/jay/node_modules/sequelize/lib/sequelize/model-definition.js:67:18)
at [object Object].find (/Users/jay/node_modules/sequelize/lib/sequelize/model-definition.js:136:15)
at [object Context]:1:6
at Interface.<anonymous> (repl.js:171:22)
at Interface.emit (events.js:64:17)
at Interface._onLine (readline.js:153:10)
at Interface._line (readline.js:408:8)
有人知道我做错了什么以及如何让这件事发挥作用?感谢。
答案 0 :(得分:0)
好的,我刚刚发布了支持node-mysql 0.9.4的v1.1.0。请试一试,告诉我它是否适合您。