1、安装插件
npm install mysql
2、调用代码
var mysql = require(‘mysql‘) var connection = mysql.createConnection({ host : ‘localhost‘, user : ‘root‘, password : ‘root‘, database : ‘sm1_syxcmzb_cn‘ }) connection.connect(); connection.query(‘select * from `tp_admin_user`‘,function (error, results, fields) { if (error) throw error; console.log(‘The solution is :‘, results) }) connection.end();
原文地址:https://www.cnblogs.com/jasonLiu2018/p/11373257.html
时间: 2024-10-30 08:40:34