无法连接到我的dockerized MySQL / MariaDB Node.js

时间:2019-11-13 03:20:44

标签: javascript mysql node.js docker mariadb

我正在使用docker运行MariaDB并在openshift上进行部署。我正在使用此命令将端口转发到我的本地端口。

oc port-forward mariadb-sdxcvv 13306:3306

在我的节点项目中。我通过包mariadb连接到mariadb。这是我的代码:

  this.conn = await mariadb.createConnection( {
    host: process.env.DB_HOST,
    user: process.env.DB_USER,
    password: process.env.DB_PWD,
    database: process.env.DB_NAME,
    port: process.env.DB_PORT
  } );

我收到此错误

Access denied for user 'admin'@'127.0.0.1' (using password: NO)

这是我在mariadb容器中对用户的授予访问权限

| User  | Host      |
+-------+-----------+
| admin | 127.0.0.1 |
| root  | 127.0.0.1 |
| root  | ::1       |
| admin | localhost |
| root  | localhost |
+-------+-----------+


+-----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for admin@127.0.0.1                                                                                                              |
+-----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY PASSWORD '*EA3E87A342924C7419B8D1400798D4E63FBF0930' WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------------------------------------------------+

我哪里错了?请帮助我

0 个答案:

没有答案