nodejs-express-mysql
nodejs-express-mysql copied to clipboard
Where is the entrance to config my db name?
Where is the entrance to config my db name?
hi , you have to create one .js file then you have to write the following code to access database
install mysql package then write the code to the file.
var mysql = require('mysql');
var con = mysql.createConnection({ host: "localhost", user: "yourusername", password: "yourpassword" });
con.connect(function(err) { if (err) throw err; console.log("Connected!"); con.query("mension query here", function (err, result) { if (err) throw err; console.log("Database created"); }); });