问题
I'm trying to connect an Express app to MariaDB, both running on localhost.
I have the following code in an Express app:
const mariadb = require('mariadb');
const pool = mariadb.createPool({
user: 'testuser',
password: 'password',
database: 'test',
connectionLimit: 5
});
I can connect using 'testuser' from the MariaDB command line, but when Express executes the code above, I see the following in the console:
SQLError: (conn=63, no: 1698, SQLState: 28000) Access denied for user 'testuser'@'localhost'
...
code: 'ER_ACCESS_DENIED_NO_PASSWORD_ERROR'
I have tried setting the testuser password to ''. Have also tried using root user credentials. I always get the same NO_PASSWORD error.
I am running this in Ubuntu 18.04 within Windows Subsystem for Linux/WSL.
Any help is appreciated.
来源:https://stackoverflow.com/questions/59332683/mariadb-connection-to-expressjs-access-denied-no-password-error