Node Js

MySQL Database connection from node js application

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…

Leave a Reply

Your email address will not be published. Required fields are marked *