使用node.js连接mysql数据库-CSDN博客

网站介绍:文章浏览阅读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数据库