-2

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.

Vikrant
  • 5,290
  • 16
  • 48
  • 71
theratcoder
  • 41
  • 10
  • This question seems duplicated: https://stackoverflow.com/questions/22387459/how-to-use-sql-with-node-js – Dylan May 20 '19 at 07:02
  • I rephrased my question because people gave me answers to a question I wasn’t asking. – theratcoder May 20 '19 at 10:39
  • Also I wouldn’t say “duplicated” because that is not exactly what I am asking. Perhaps it might help, it is still not fair to say it is a “duplicate”. – theratcoder May 27 '19 at 00:02

1 Answers1

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"
});
Dylan
  • 926
  • 6
  • 20