Created
December 19, 2016 08:00
-
-
Save jsstoni/bf2df916791a32538f3efabec34ef864 to your computer and use it in GitHub Desktop.
mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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