-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[Bug]: yaml配置文件db-list 配置多数据源无法运行的问题 #2015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
看报错是没有读到你的 path,你可以截图看看你的对应配置文件不,因为我本地配置两个 pgsql 是能运行的 |
以下是全部内容 prefix: ""port: ""config: ""db-name: ""username: ""password: ""path: ""engine: ""log-mode: ""max-idle-conns: 10max-open-conns: 100singular: falselog-zap: false#mysql: prefix: ""port: "3306"config: charset=utf8mb4&parseTime=True&loc=Localdb-name: gvausername: rootpassword: "xxx"path: 192.168.5.xxxengine: ""log-mode: errormax-idle-conns: 10max-open-conns: 100singular: falselog-zap: falseoracle: 地址和密码确认是对的,因为我本地用navicat或者用java的springboot项目配置多数据源也都能连上
|
你第二个加上 config 这些参数试试? |
mssql缺少config参数导致连接失败 |
依然有报错
另外还有一个问题 `db-list: - type: mssqlalias-name: "sqlserver_db"path: "192.168.5.249"config: "charset=utf8mb4&parseTime=True&loc=Local"port: "1433"db-name: "hikvision"username: "sa"password: "xxxx"disable: false` |
dblist 并不会作为主程序使用,他只是作为你的业务数据库,所以你需要将主数据库配置在默认的地方 |
也就是说,我的主数据库是mysql,副数据库mssql。就是db-list外面配置一下MySQL.里面配置一下msssql对吗?
`GOROOT=D:\Program Files\Go #gosetup goroutine 1 [running]: Process finished with the exit code 2` |
db-list: |
所以能给个解决mssql连不上的问题的思路吗 |
去搞个mssql的初始化看看正确的配置 然后复制过来 |
2025/05/01 00:06:30 D:/magnific/HRMS-GO/gin-vue-admin/server/service/system/sys_initdb_mssql.go:61 |
gin-vue-admin 版本
v2.8.0
Node 版本
22.14.0
Golang 版本
1.24.2
是否依旧存在
可以
bug描述
1.以下是我的配置文件中db-list部分截取
db-list: - type: mysql alias-name: "mysql_main" # 主数据库别名(唯一标识) prefix: "" port: "3306" config: "charset=utf8mb4&parseTime=True&loc=Local" db-name: "gva" # MySQL 数据库名 username: "root" # MySQL 用户名 password: "xxx" # MySQL 密码 path: "192.168.5.xxx" # MySQL 主机地址 engine: "" log-mode: "error" max-idle-conns: 10 max-open-conns: 100 singular: false log-zap: false disable: false # 必须为 false 启用该数据库 - type: mssql alias-name: "sqlserver_db" path: "192.168.5.247" port: "1433" db-name: "hikvision" username: "sa" password: "xxx" disable: false
2.以下是console报错
GOROOT=D:\Program Files\Go #gosetup GOPATH=C:\Users\xiwei\go #gosetup GOPROXY=https://goproxy.cn,direct #gosetup "D:\Program Files\Go\bin\go.exe" build -o C:\Users\xiwei\AppData\Local\JetBrains\GoLand2024.3\tmp\GoLand\___go_build_github_com_flipped_aurora_gin_vue_admin_server.exe github.com/flipped-aurora/gin-vue-admin/server #gosetup C:\Users\xiwei\AppData\Local\JetBrains\GoLand2024.3\tmp\GoLand\___go_build_github_com_flipped_aurora_gin_vue_admin_server.exe #gosetup 2025/04/18 16:39:36 maxprocs: Leaving GOMAXPROCS=16: CPU quota undefined 您正在使用gin模式的debug环境名称,config的路径为config.yaml D:/magnific/HRMS-GO/gin-vue-admin/server/initialize/gorm_mssql.go:51 [info] replacing callback
gorm:createfrom D:/magnific/HRMS-GO/gin-vue-admin/server/initialize/gorm_mssql.go:51 D:/magnific/HRMS-GO/gin-vue-admin/server/initialize/gorm_mssql.go:51 [info] replacing callback
gorm:update` from D:/magnific/HRMS-GO/gin-vue-admin/server/initialize/gorm_mssql.go:51D:/magnific/HRMS-GO/gin-vue-admin/server/initialize/gorm_mssql.go:51
[error] failed to initialize database, got error unable to open tcp connection with host 'localhost:1433': dial tcp [::1]:1433: connectex: No connection could be made because the target machine actively refused it.panic: unable to open tcp connection with host 'localhost:1433': dial tcp [::1]:1433: connectex: No connection could be made because the target machine actively refused it.
goroutine 1 [running]:
github.com/flipped-aurora/gin-vue-admin/server/initialize.GormMssqlByConfig({{{0x0, 0x0}, {0xc000cd33b4, 0x4}, {0x0, 0x0}, {0xc000cd33c0, 0x9}, {0xc000cd33d8, 0x2}, ...}})
D:/magnific/HRMS-GO/gin-vue-admin/server/initialize/gorm_mssql.go:52 +0x356
github.com/flipped-aurora/gin-vue-admin/server/initialize.DBList()
D:/magnific/HRMS-GO/gin-vue-admin/server/initialize/db_list.go:21 +0x165
main.main()
D:/magnific/HRMS-GO/gin-vue-admin/server/main.go:37 +0xb7
Process finished with the exit code 2`
3.假如db-list mssql这段去掉能运行成功,但是系统找不到数据库,登录页报错用户不存在。
4.假如不配置db-list 在外部单单配置mysql属性是能启动的,登录页也能正常登录
修改建议
No response
The text was updated successfully, but these errors were encountered: