nodejs-express-mysql icon indicating copy to clipboard operation
nodejs-express-mysql copied to clipboard

Where is the entrance to config my db name?

Open Coca-code opened this issue 1 year ago • 1 comments

Where is the entrance to config my db name?

Coca-code avatar Feb 02 '24 08:02 Coca-code

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"); }); });

kavya-debug avatar Feb 05 '25 08:02 kavya-debug