'Connect sequelize to mysql on MACOS using XAMP

I'm nex to using macos environment and i'm having trouble connecting sequelize to mysql server that's running on xamp

I'm able to open phpmyadmin dashboard through localhost:8080/phpmyadmin/ I can also CLEARLY SEE on XAMP that there's another IP address which is 192.168.64.2

xamp

Here's my db.config

    HOST: process.env.HOST,
  USER: process.env.USER,
  PASSWORD: process.env.PASSWORD,
  DB: process.env.DB,
  dialect: 'mysql',
  pool: {
    max: 5,
    min: 0,
    acquire: 30000,
    idle: 10000,
  },

and my .env file contains these parameters

I have tried many alternatives such as

#mysql config Variables

HOST=localhost
USER=root
PASSWORD=
DB=cynoia
DIALECT=mysql`

#mysql config Variables

HOST=192.168.64.2
USER=root
PASSWORD=
DB=cynoia
DIALECT=mysql

I have even created a new user and tried to connect with his accesses

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;

CREATE USER 'username'@'%' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES;

But nothing to seems to work the error is always the same

access denied for user

Access denied for user 'imac'@'192.168.64.1' (using password: NO)
      at Packet.asError (/Users/imac/Documents/CYNOIA-back-main/node_modules/mysql2/lib/packets/packet.js:728:17)
      at ClientHandshake.execute (/Users/imac/Documents/CYNOIA-back-main/node_modules/mysql2/lib/commands/command.js:29:26)
      at Connection.handlePacket (/Users/imac/Documents/CYNOIA-back-main/node_modules/mysql2/lib/connection.js:456:32)
      at PacketParser.onPacket (/Users/imac/Documents/CYNOIA-back-main/node_modules/mysql2/lib/connection.js:85:12)
      at PacketParser.executeStart (/Users/imac/Documents/CYNOIA-back-main/node_modules/mysql2/lib/packet_parser.js:75:16)
      at Socket.<anonymous> (/Users/imac/Documents/CYNOIA-back-main/node_modules/mysql2/lib/connection.js:92:25)
      at Socket.emit (node:events:390:28)
      at Socket.emit (node:domain:475:12)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9) {
    code: 'ER_ACCESS_DENIED_ERROR',
    errno: 1045,
    sqlState: '28000',
    sqlMessage: "Access denied for user 'imac'@'192.168.64.1' (using password: NO)",
    sql: undefined

I cannot seem to understand why it shows user 'imac' even though that's not the user i need and why it doesnt work simply on localhost I'm a windows user it never happened to me before, can anyone provide any help ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source