nodeJS mySQL
unknown
plain_text
5 months ago
572 B
1
Indexable
var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', database : 'BUS', user : 'root', password : 'alex', }); connection.connect(function(err) { if (err) { console.error('Error connecting: ' + err.stack); return; } console.log('Connected as id ' + connection.threadId); }); connection.query('SELECT * FROM BUS.B_Data', function (error, results, fields){ if(error) throw error; results.forEach(result => { console.log(result); }) })
Editor is loading...
Leave a Comment