Install MySQL
    npm i mysql
Create db-example.js

var mysql = require('mysql')
var connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'root',
database: 'project_db'
})

connection.connect()

connection.query('SELECT 1 + 1 AS solution', function (err, rows, fields) {
if (err) throw err

console.log('The solution is: ', rows[0].solution)
})

connection.end()
Test
    node db-example.js