node数据库安装和连接
https://www.bilibili.com/video/BV1a34y167AZ?p=59数据库安装步骤
npm install mysql --save
const mysqls = require('mysql')
const conn = mysqls.createConnection({
connectionLimit: 10,
host: 'localhost',
user: 'root',
password: 'zjxzhj123',
port: '3306',
database: 'mydb'
})
conn.connect()
let sql = 'SELECT * FROM mydb.users'
conn.query(sql,(err,result)=>{
if (err) console.log(err);
console.log(result);
})
conn.end()
本文来自博客园,作者:zjxgdq,转载请注明原文链接:https://www.cnblogs.com/zjxzhj/p/15878697.html