Failed to connect to the database

Connect to the database in the framework automatically generated by express

connect.js Code

const mysql = require("mysql");

const db = mysql.createConnection({
  host: "localhost",
  port: 3306,
  user: "root",
  database: "ningxia"
})

db.connect((error) => {
  if (error) {
    console.log(error)
    console.log("")
  } else {
    console.log("")
  }
})

module.exports = db

introduce the connect.js file into the Index.js of api, and the small blackboard indicates that the connection failed

Jun.18,2022
Does the

database have a password?


should be port number 3306 is occupied, another MySQL is opened and another wampserver, port is occupied. After I turn off wampserver, I can link successfully

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35e62-2b74a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35e62-2b74a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?