Accessing sqlite3 database through node.js

Hi.
I set up a database through the Terminal in Glitch. (.sqlite3 …> .open test.db). Now I want to access it through my server.js. I used:

  const mysql = require("mysql");
  const connection = mysql.createConnection({
    host: "localhost",
    user: "root",
    password: "12345",
    database: "test",
  });

  connection.connect((err) => {
    if (err) {
      console.error("Fehler bei der Verbindung: " + err.stack);
      return;
    }

    console.log("Verbunden als ID " + connection.threadId);
  });

That won’t work. Error message:
Error: connect ECONNREFUSED 127.0.0.1:3306
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)

I didn’t set any users or passwords anywhere - this seems not to be able since I can’t user sudo in the terminal.
Can anybody help, I’d really appreciate it.

you’ve mistakenly tried to connect to a mysql database instead of a sqlite3 one. there’s a sqlite3 starter that shows how to “connect” to a sqlite3 database.