So I am trying to connect my SQL database to an HTML file for my website. I have heard that you can use Node.js to do this, but I am not sure how to add node.js to my HTML and also connect it to my other JavaScript so I can record things from there.
Asked
Active
Viewed 533 times
-2
-
This question seems duplicated: https://stackoverflow.com/questions/22387459/how-to-use-sql-with-node-js – Diya Li May 20 '19 at 07:02
1 Answers
0
you need to install nodejs first.refer this:https://nodejs.org/en/download/
then you need to install mysql using : npm install mysql
then configure mysql using :
const mysql = require('mysql');
var pool = mysql.createPool({
connectionLimit: 100,
host : "localhost",
user : "username",
password : "password",
database : "databasename"
});

Diya Li
- 1,048
- 9
- 21

KRISHNA KANT SINGH
- 77
- 1
- 5