无法连接到sails v1.0中的本地mysql

kyks70gy  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(213)

我是sails的新手,目前正在研究sails项目和mysql之间的连接。我发现mysql工作台上的“客户端连接”在我扬帆后没有显示任何连接,我也无法从mysql获取任何数据。
[配置/datastores.js]

module.exports.datastores = {
  default: {
    adapter: require('sails-mysql'),
    url: 'mysql://root:pw@localhost:3306/database',
  }
};

[api/型号]

module.exports = {

  attributes: {
    'username': {
      type: 'string',
    },
    'email': {
      type: 'string',
    },
    'password': {
      type: 'string',
    },
    'create_time': {
      type: 'string',
    },
  },
};

[api/开发控制器]

module.exports = {
  index: function(req,res){
      model.find().exec(function(err,info){
        return res.json(info);
      });
  },
};

帆升起后,船就空了。这是漏了什么还是错了?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题