网站介绍:文章浏览阅读101次。连接之前,你要有数据库和表结构代码:let mysql = require('mysql')// 1. 创建连接const connection = mysql.createConnection({ host: 'localhost', user: 'root', password: '1234567', database: 'node-test'})// 2. 连接数据库connection.connect()// 3. 执行数据操作connecti_node.js连接mysql数据库
- 链接地址:https://blog.csdn.net/qq_43612538/article/details/109190093
- 链接标题:使用node.js连接mysql数据库-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:2063
- 网站标签:node.js连接mysql数据库