详细步骤,怎样用node.js连接mysql数据库
详细步骤,怎样用node.js连接mysql数据库
npm install knex@0.6 --save
npm install mysqlvar knex = require(knex)({
  client: mysql,
  connection: {
    host     : 127.0.0.1,
    user     : your_database_user,
    password : your_database_password,
    database : myapp_test
  }
})knex.select(title, author, year).from(books).then(function(data){
//取到的数据
console.log(data)
})
更多:
http://knexjs.org/