Browse Source

fix: 解决数据库用户名显示错误的问题 (#2028)

release-1.5 v1.5.3
ssongliu 1 year ago committed by wanghe-fit2cloud
parent
commit
0eee2d9807
  1. 5
      backend/utils/mysql/client/local.go
  2. 5
      backend/utils/mysql/client/remote.go

5
backend/utils/mysql/client/local.go

@ -305,19 +305,18 @@ func (r *Local) SyncDB(version string) ([]SyncDBInfo, error) {
}
}
if len(dataItem.Username) == 0 {
username := loadNameByDB(parts[0], version)
dataItem.Username = loadNameByDB(parts[0], version)
if err := r.CreateUser(CreateInfo{
Name: parts[0],
Format: parts[1],
Version: version,
Username: username,
Username: dataItem.Username,
Password: common.RandStr(16),
Permission: "%",
Timeout: 300,
}, false); err != nil {
global.LOG.Errorf("sync from remote server failed, err: create user failed %v", err)
}
dataItem.Username = parts[0]
dataItem.Permission = "%"
} else {
if isLocal {

5
backend/utils/mysql/client/remote.go

@ -316,19 +316,18 @@ func (r *Remote) SyncDB(version string) ([]SyncDBInfo, error) {
i++
}
if len(dataItem.Username) == 0 {
userName := loadNameByDB(dbName, version)
dataItem.Username = loadNameByDB(dbName, version)
if err := r.CreateUser(CreateInfo{
Name: dbName,
Format: charsetName,
Version: version,
Username: userName,
Username: dataItem.Username,
Password: common.RandStr(16),
Permission: "%",
Timeout: 300,
}, false); err != nil {
return datas, fmt.Errorf("sync db from remote server failed, err: create user failed %v", err)
}
dataItem.Username = dbName
dataItem.Permission = "%"
} else {
if isLocal {

Loading…
Cancel
Save