* 描述问题
我有两台服务器,一台A(应用服务),一台B(数据库服务)
我数据库是安装在B服务器的mysql,在A服务器使用mysql命令行客户端可以成功远程连接B的数据库,在其它windows电脑用navicat也可以远程连接B的数据库。但是A服务器如下执行安装时安装程序报错被拒绝连接数据库,不知啥原因。
[root@nacoserver my-nocobase]# yarn nocobase install --lang=zh-CN
yarn run v1.22.22
$ nocobase install --lang=zh-CN
WAIT: TypeScript compiling...
2025-03-18 17:14:02 [debug] create database instance: {"sync":{"alter":{"drop":false},"force":false},"dialect":"mysql","username":"root","database":"nacodb","port":"3306","timezone":"+08:00","tablePrefix":"noco_","underscored":false,"migrator":{"context":{"app":{"appName":"main","name":"main"}}},"logger":{},"rawTimezone":"+08:00"} meta={"databaseInstanceId":"lUC3bzg98GqVoLJnrHJY3"} module=database app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:02 [info] add app main into supervisor module=application submodule=supervisor method=addApp app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:02 [warn] attempt 1/9: Unable to connect to the database: Access denied for user 'root'@'10.10.1.252' (using password: YES) module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:02 [warn] will retry in 50ms... module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:02 [warn] attempt 2/9: Unable to connect to the database: Access denied for user 'root'@'10.10.1.252' (using password: YES) module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:02 [warn] will retry in 100ms... module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:02 [warn] attempt 3/9: Unable to connect to the database: Access denied for user 'root'@'10.10.1.252' (using password: YES) module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:02 [warn] will retry in 200ms... module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:02 [warn] attempt 4/9: Unable to connect to the database: Access denied for user 'root'@'10.10.1.252' (using password: YES) module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:02 [warn] will retry in 400ms... module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:03 [warn] attempt 5/9: Unable to connect to the database: Access denied for user 'root'@'10.10.1.252' (using password: YES) module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:03 [warn] will retry in 800ms... module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:04 [warn] attempt 6/9: Unable to connect to the database: Access denied for user 'root'@'10.10.1.252' (using password: YES) module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:04 [warn] will retry in 1600ms... module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:05 [warn] attempt 7/9: Unable to connect to the database: Access denied for user 'root'@'10.10.1.252' (using password: YES) module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:05 [warn] will retry in 3200ms... module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:08 [warn] attempt 8/9: Unable to connect to the database: Access denied for user 'root'@'10.10.1.252' (using password: YES) module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:15 [warn] attempt 9/9: Unable to connect to the database: Access denied for user 'root'@'10.10.1.252' (using password: YES) module=database method=auth app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:15 [error] Unable to connect to the database stack=Error: Unable to connect to the database
at AsyncEmitter.auth (/root/my-nocobase/packages/core/database/src/database.ts:838:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async AsyncEmitter.authenticate (/root/my-nocobase/packages/core/server/src/application.ts:708:5)
at async Object.callback (/root/my-nocobase/packages/core/server/src/application.ts:1133:11)
at async AppCommand.parseAsync (/root/my-nocobase/packages/core/server/node_modules/commander/lib/command.js:935:5)
at async AsyncEmitter.runAsCLI (/root/my-nocobase/packages/core/server/src/application.ts:803:23) module=application app=main reqId=13215955-d911-4758-98ca-198e7f594b12 dataSourceKey=main
2025-03-18 17:14:15 [error] Access denied for user 'root'@'10.10.1.252' (using password: YES) stack=SequelizeAccessDeniedError: Access denied for user 'root'@'10.10.1.252' (using password: YES)
at ConnectionManager.connect (/root/my-nocobase/node_modules/sequelize/src/dialects/mysql/connection-manager.js:118:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ConnectionManager._connect (/root/my-nocobase/node_modules/sequelize/src/dialects/abstract/connection-manager.js:332:24)
at async <anonymous> (/root/my-nocobase/node_modules/sequelize/src/dialects/abstract/connection-manager.js:250:32)
at async ConnectionManager.getConnection (/root/my-nocobase/node_modules/sequelize/src/dialects/abstract/connection-manager.js:280:7)
at async <anonymous> (/root/my-nocobase/node_modules/sequelize/src/sequelize.js:638:26)
at async Sequelize.authenticate (/root/my-nocobase/node_modules/sequelize/src/sequelize.js:972:5)
at async BackOff.authenticate (/root/my-nocobase/packages/core/database/src/database.ts:816:9) app=main reqId=13215955-d911-4758-98ca-198e7f594b12
Done in 23.41s.
* 运行环境
- NocoBase 版本:
还不太清楚在哪看版本号,是前两周下载的最新稳定版.
- 数据库种类与版本:
mysql Ver 8.0.20 for Linux on x86_64 (MySQL Community Server - GPL)
- 操作系统:
Rocky Linux release 9.5 (Blue Onyx)
- 部署方式:
源码
- Docker 镜像版本:
- NodeJS 版本:
v20.18.2
如何重现
执行如下命令可重现:
[root@nacoserver my-nocobase]# yarn nocobase install --lang=zh-CN
我确保配置文件中的数据库连接信息是没问题的。相关DB配置如下: