Check out example codes for "npm mysql". It will help you in understanding the concepts better.

Code Example 1

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

Code Example 2

var mysql = require('mysql');

Code Example 3

$ npm install mysql

Learn ReactJs, React Native from akashmittal.com