var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "myusername",
password: "mypassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
//Insert a record in the "customers" table:
var sql = "INSERT INTO customers (name, address) VALUES ('Company Inc', 'Highway 37')";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("1 record inserted");
});
});