Skip to content
0:00 / 0:00

#express#mysql#node.js

How to connect MySQL using node JS express

Nodejspool

19 subscribers • 1 video on Hallway

YouTube
  • Recommended by 1 person: 1 on Stack Overflow and its sister sites.
  • Linked in the descriptionsaiumesh535/MySQLNodejsDemo
  • May be out of date. The tools, versions or practices it shows have likely moved on.

Beginner. No background in the topic needed.

3K views9 years ago1 recommendation

Web developmentDatabases and dataNode.js, Deno and BunMySQL

How to establish a connection between a MySQL database and a Node.js Express application.

This video helps you to understand how to connect MySQL database using node js express app. if you have any doubts please let me know in comment section below or you can contact on twitter twitter.com/saiumesh. to know more about MySQL module please go through the link npmjs.com/package/mysql. download project from here github.com/saiumesh535/MySQLNodejsDemo

Why it's here

1 person recommends this

What people say. Linked as a guide for setting up proper MySQL connection pooling in Node.js applications.

Adiiion Stack Overflow • Recommends

On “i am getting cannot read property 'query' of undefined”

It seems there is error in your mysql connection.try make proper connection first Step 1: Create the pool (only do this once) var mysql = require('mysql'); var pool = mysql.createPool({ host : 'hostname', user : 'username', password : 'password', database : 'db_name', connectionLimit : 10, // this is the max number of connections before your pool starts waiting for a release multipleStatements : true // I like this because it helps prevent nested sql statements, it can be buggy though, so be careful }); Step 2: Get a connection pool.getConnection(function (err, conn) { if (err) return res.send(400); // if you got a connection... conn.query('SELECT * FROM table WHERE id=…