Skip to content

Instantly share code, notes, and snippets.

@lucaspg96
Created March 29, 2017 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucaspg96/1ec1cca9c2481f2be364829f578b5674 to your computer and use it in GitHub Desktop.
Save lucaspg96/1ec1cca9c2481f2be364829f578b5674 to your computer and use it in GitHub Desktop.
var mysql = require('mysql')
var connection = mysql.createConnection({
host: "localhost",
user: process.env.USER_MYSQL,
password: process.env.PASS_MYSQL,
database: "test"
})
connection.connect()
connection.query('SELECT * from contacts',function(err,rows,fields){
if (err) {
console.log("Error!")
}
else{
console.log(rows)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment