skip to Main Content

I have problem when i want start express server, i got the following error

Unable to connect to the database: ConnectionError [SequelizeConnectionError]: (conn:3, no: 45025, SQLState: 08004) Client does not support authentication protocol 'auth_gssapi_client' requested by server.
    at ConnectionManager.connect (F:CodeWebapr-tsbackendnode_modulessequelizelibdialectsmariadbconnection-manager.js:100:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ConnectionManager._connect (F:CodeWebapr-tsbackendnode_modulessequelizelibdialectsabstractconnection-manager.js:222:24)
    at async F:CodeWebapr-tsbackendnode_modulessequelizelibdialectsabstractconnection-manager.js:174:32 {
  parent: SqlError: (conn:3, no: 45025, SQLState: 08004) Client does not support authentication protocol 'auth_gssapi_client' requested by server.
      at module.exports.createFatalError (F:CodeWebapr-tsbackendnode_modulesmariadblibmiscerrors.js:90:10)
      at Authentication.pluginHandler (F:CodeWebapr-tsbackendnode_modulesmariadblibcmdhandshakeauthentication.js:274:20)
      at Authentication.dispatchAuthSwitchRequest (F:CodeWebapr-tsbackendnode_modulesmariadblibcmdhandshakeauthentication.js:242:36)
      at Authentication.handshakeResult (F:CodeWebapr-tsbackendnode_modulesmariadblibcmdhandshakeauthentication.js:62:14)
      at Authentication.onPacketReceive (F:CodeWebapr-tsbackendnode_modulesmariadblibcmdhandshakeauthentication.js:40:17)
      at PacketInputStream.receivePacketBasic (F:CodeWebapr-tsbackendnode_modulesmariadblibiopacket-input-stream.js:85:9)
      at PacketInputStream.onData (F:CodeWebapr-tsbackendnode_modulesmariadblibiopacket-input-stream.js:135:20)
      at Socket.emit (node:events:518:28)
      at addChunk (node:internal/streams/readable:559:12)
      at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) {
    sqlMessage: "Client does not support authentication protocol 'auth_gssapi_client' requested by server.",
    sql: null,
    fatal: true,
    errno: 45025,
    sqlState: '08004',
    code: 'ER_AUTHENTICATION_PLUGIN_NOT_SUPPORTED'
  },
  original: SqlError: (conn:3, no: 45025, SQLState: 08004) Client does not support authentication protocol 'auth_gssapi_client' requested by server.
      at module.exports.createFatalError (F:CodeWebapr-tsbackendnode_modulesmariadblibmiscerrors.js:90:10)
      at Authentication.pluginHandler (F:CodeWebapr-tsbackendnode_modulesmariadblibcmdhandshakeauthentication.js:274:20)
      at Authentication.dispatchAuthSwitchRequest (F:CodeWebapr-tsbackendnode_modulesmariadblibcmdhandshakeauthentication.js:242:36)
      at Authentication.handshakeResult (F:CodeWebapr-tsbackendnode_modulesmariadblibcmdhandshakeauthentication.js:62:14)
      at Authentication.onPacketReceive (F:CodeWebapr-tsbackendnode_modulesmariadblibcmdhandshakeauthentication.js:40:17)
      at PacketInputStream.receivePacketBasic (F:CodeWebapr-tsbackendnode_modulesmariadblibiopacket-input-stream.js:85:9)
      at PacketInputStream.onData (F:CodeWebapr-tsbackendnode_modulesmariadblibiopacket-input-stream.js:135:20)
      at Socket.emit (node:events:518:28)
      at addChunk (node:internal/streams/readable:559:12)
      at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) {
    sqlMessage: "Client does not support authentication protocol 'auth_gssapi_client' requested by server.",
    sql: null,
    fatal: true,
    errno: 45025,
    sqlState: '08004',
    code: 'ER_AUTHENTICATION_PLUGIN_NOT_SUPPORTED'
  }
}

yes, i already follow the solution from the similiar questions before me, like i did

ALTER USER 'your_username'@'your_host' IDENTIFIED VIA mysql_native_password USING PASSWORD('your_password');
FLUSH PRIVILEGES;

and did

SELECT user, host, plugin FROM mysql.user WHERE user = 'your_username';

but it’s not working. i use sequelize as ORM. but when i just define my Database configuration in app.js (as my server file) and i run node app.js to start server, it’s working.
Using this is working, but neither sequelize included.

const mariadb = require('mariadb');

const pool = mariadb.createPool({
    host: 'your_host',
    user: 'your_username',
    password: 'your_password',
    database: 'your_database',
    connectionLimit: 5
});

async function connectDatabase() {
    let conn;
    try {
        conn = await pool.getConnection();
        console.log("Connected to the database!");
    } catch (err) {
        console.error("Unable to connect to the database:", err);
    } finally {
        if (conn) conn.release(); // release to the pool
    }
}

connectDatabase();

while i use configuration db connection in different files. i define some db config like dbname, dbuser, dbhost, dbpassword, port, dbport in .env then it’s read by config.js. which config.js provide data to database.js, and then reach the app.js. like should my app.js as my server:

const express = require('express');
const dotenv = require('dotenv');
const cors = require('cors');
const sequelize = require('./config/database');
const routerApi = require('./routes');

// Load environment variables from .env file
dotenv.config();

const app = express();
const port = process.env.PORT || 8080;

app.use(cors());
app.use(express.json());

app.get('/', (req, res) => {
    res.send('Backend con NodeJS - Express + CRUD API REST + MySQL');
});

// Apply the routes
routerApi(app);

// Connect to the database and start the server
sequelize.authenticate()
    .then(() => {
        console.log('Connection to the database has been established successfully.');
        app.listen(port, () => {
            console.log(`Server is running on port ${port}`);
        });
    })
    .catch(err => {
        console.error('Unable to connect to the database:', err);
        process.exit(1);  // Exit the process with failure code
    });

i try to connecting my database, to my backend and test it using postman, rather than json response, the response is nothing, just refusing 8080 port, because i still fail to start my node express server,
Any response / suggestion will be very thankful!

2

Answers


  1. a) You passed wrong password.
    b) You used "root" user.
    c) Your server is on Windows

    If you’re not doing either a) or b) or c), you won’t see the error. I’d recommend not to do b). Yet bottom-line, seeing this error only means "I tried the password, it did not work, I used fallback, it did not work either, on different reason"

    Login or Signup to reply.
  2. MariaDB Connector/Node.js currently doesn’t support the plugin auth_gssapi_client.

    Feature request: CONJS-72 Implement auth_gssapi_client support

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search