Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

nodejs中配置Sequelize的问题,报了 SequelizeAccessDeniedError错

$
0
0

我输入了下面这两个数据库授权语句后还是没效果 grant all privileges on todolist.* to 'zcl'@'localhost' identified by '123456';flush privileges;这是我的app.js文件

const config = {
	database: 'todolist',
	username: 'root',
	password: 123456,
	host: 'localhost',
	port: 3306
};
const sequelize = new Sequelize(config.database,config.username,config.password,{
  host: config.host,
  dialect: 'mysql',
  pool: {
    max:5,
    min:0,
    idle:30000
  }
});
var Todolist = sequelize.define('todolist',{
  id: {
    type: Sequelize.BIGINT,
    primaryKey: true
  },
  text: Sequelize.STRING(50),
  completed: Sequelize.BIGINT
},{
  timestamps:false,
  freezeTableName: true
});
Todolist.create({
  id: 1,
  text:'aaaa',
  completed: 1
}).then(function(p) {
  console.log('create',JSON.stringify(p));
}).catch(function(err) {
  console.log('err',err);
});

我的数据库有一个todolist表, 授权以后还是报原来的错,有没有大神知道问题出在哪了


Viewing all articles
Browse latest Browse all 14821

Trending Articles