当前位置:首页>开发>正文

详细步骤,怎样用node.js连接mysql数据库

2023-04-13 18:51:43 互联网 未知 开发

 详细步骤,怎样用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/

最新文章