How to connect nodejs with MySQL

Node.js can be used in database applications. One of the most popular databases is MySQL. To be able to experiment with the code examples, you should have MySQL installed on your computer. You can download a free MySQL database at

Once you have MySQL up and running on your computer, you can access it by using Node.js. To access a MySQL database with Node.js, you need a MySQL driver.
Now you have downloaded and installed a mysql database driver. Node.js can use this module to manipulate the MySQL database: var mysql = require(‘mysql’);

Start by creating a connection to the database. Use the username and password from your MySQL database. :white_check_mark:


iamjust confusee

1 Like