MariaDB connection to ExpressJS access denied no password error

那年仲夏 提交于 2021-01-29 08:40:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!