Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mysql node

const mysql = require("mysql");
const mysqlDb = mysql.createConnection({
	host: process.env.mysql_HOST || "localhost",
	user: process.env.mysql_USER || "root",
	password: process.env.mysql_PASSWORD || "",
	database: process.env.mysql_DATABSE || "my_db"
});

mysqlDb.connect(err => {
	if(err) throw err;
});

module.exports = mysqlDb;
 
PREVIOUS NEXT
Tagged: #mysql #node
ADD COMMENT
Topic
Name
4+6 =