Welcome aboard! We are happy you are here and wish you good net-raft!
// at first you install "npm install mysql"
//put this code into app.js
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "username",
password: "password",
database: "MyDb"
});
con.connect(function(err) {
if (err) throw err;
var sql = "DELETE FROM my_customers WHERE name = 'xxx'";
con.query(sql, function (err, result) {
if (err) throw err;
console.log(result.affectedRows);
});
});
// type "node app.js" in command prompt
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 7.5K 1.7K