Skip to content

Instantly share code, notes, and snippets.

@jsstoni
Created December 19, 2016 08:00
Show Gist options
  • Save jsstoni/bf2df916791a32538f3efabec34ef864 to your computer and use it in GitHub Desktop.
Save jsstoni/bf2df916791a32538f3efabec34ef864 to your computer and use it in GitHub Desktop.
mysql
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret',
database : 'my_db'
});
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
if (err) throw err;
console.log('The solution is: ', rows[0].solution);
});
connection.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment