In This video I have shown how to connect MySQL database from node js Application.
1. create node project "npm init -y"
2. install mysql package "npm install mysql"
3. create a file like "database.js"
4. import mysql package "const { createPool } = require('mysql')"
5. create pool connection
-----------------------------------------
const pool = createPool({
host: "localhost",
user: "root",
password: "",
database: "test",
connectionLimit: 10
})
6. execute query
---------------------------
pool.query(`select * from registration`, function(err, result, fields) {
if (err) {
return console.log(err);
}
return console.log(result);
})
On this page of the site you can watch the video online MySQL Database connection from node js application with a duration of hours minute second in good quality, which was uploaded by the user Technical Babaji (Tarique Akhtar) 18 December 2019, share the link with friends and acquaintances, this video has already been watched 396,959 times on youtube and it was liked by 3.9 thousand viewers. Enjoy your viewing!