Skip to content

Commit b474fe7

Browse files
committed
fix: 修复初始化PostgreSQL时尝试数据库连接验证时用户名同名数据库不存在导致的初始化失败问题
https://www.postgresql.org/docs/current/app-initdb.html The postgres database is a default database meant for use by users, utilities and third party applications. 默认数据库postgres一般存在,但用户名同名数据库不一定存在
1 parent bf1cd15 commit b474fe7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/model/system/request/sys_init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ func (i *InitDB) PgsqlEmptyDsn() string {
3434
i.Host = "127.0.0.1"
3535
}
3636
if i.Port == "" {
37-
i.Port = "3306"
37+
i.Port = "5432"
3838
}
39-
return "host=" + i.Host + " user=" + i.UserName + " password=" + i.Password + " port=" + i.Port + " " + "sslmode=disable TimeZone=Asia/Shanghai"
39+
return "host=" + i.Host + " user=" + i.UserName + " password=" + i.Password + " port=" + i.Port + " dbname=" + "postgres" + " " + "sslmode=disable TimeZone=Asia/Shanghai"
4040
}
4141

4242
// ToMysqlConfig 转换 config.Mysql

0 commit comments

Comments
 (0)