Node.js 操作MySQL

npm i mysql //安装模块   var mysql = require('mysql'); //创建链接 var connection = mysql.createConnection({     host: 'localhost',     user: 'root',     password: 'root',     database: 'my_db',
});
//链接数据库 connection.connect();
//执行数据操作 connection.query(`INSERT INTO users values(0009,"daxiong","123456")`, function(error, results, fields) {     if (error) throw error;     console.log('The solution is: ', results[0].solution); });
//关闭连接 connection.end();
上一篇:Dapper in .Net Core


下一篇:ORM框架Dapper详细教程