MySQL Integration with Node.js

Published July 26, 2025 By Sai Sree Ram Gundepudi

Node.js Example

const mysql = require('mysql2');
const connection = mysql.createConnection({host: 'localhost', user: 'root', database: 'employees'});
connection.query('SELECT * FROM employees', (err, results) => {
  console.log(results);
});

Was this solution helpful?

Your feedback helps improve our technical knowledge repository.

Share this article