1、先安装mysql
$ npm install mysql
2、直接上代码
var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', user : 'root', password : '123456', database : 'dataname' }); connection.connect(); connection.query('查表的SQL语句', function (error, results, fields) { if (error) throw error; console.log('The solution is: ', results[0].solution); });
标签: mysql
上面是“用nodejs搭建一个MySQL版的接口”的全面内容,想了解更多关于 nodejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_88.html
workflows工作流
一只在星系中漂浮宇宙生物ComfyUI工作流
懂王特朗普3d漫画ComfyUI工作流
图生图局部重绘ComfyUI工作流
一个外国人在吹奏萨克斯ComfyUI工作流
冬天的严寒里红梅枝上停留着一只鸟
1个可爱的白色短发女孩
一张科幻照片,火星车在沙漠里ComfyUI工作流
一个20岁丰满的女孩ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!