mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
fix: 解决 MySQL 8.x 切换数据库访问权限导致创建数据库失败的问题 (#2281)
This commit is contained in:
parent
8bc6b409d9
commit
279f8f0e6c
@ -72,9 +72,9 @@ func (r *Local) CreateUser(info CreateInfo, withDeleteDB bool) error {
|
|||||||
Timeout: 300})
|
Timeout: 300})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
grantStr := fmt.Sprintf("grant all privileges on `%s`.* to %s", info.Name, user)
|
grantStr := fmt.Sprintf("grant all privileges on `%s`.* to %s with grant option;", info.Name, user)
|
||||||
if info.Name == "*" {
|
if info.Name == "*" {
|
||||||
grantStr = fmt.Sprintf("grant all privileges on *.* to %s", user)
|
grantStr = fmt.Sprintf("grant all privileges on *.* to %s with grant option;", user)
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(info.Version, "5.7") || strings.HasPrefix(info.Version, "5.6") {
|
if strings.HasPrefix(info.Version, "5.7") || strings.HasPrefix(info.Version, "5.6") {
|
||||||
grantStr = fmt.Sprintf("%s identified by '%s' with grant option;", grantStr, info.Password)
|
grantStr = fmt.Sprintf("%s identified by '%s' with grant option;", grantStr, info.Password)
|
||||||
|
@ -75,9 +75,9 @@ func (r *Remote) CreateUser(info CreateInfo, withDeleteDB bool) error {
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
grantStr := fmt.Sprintf("grant all privileges on `%s`.* to %s", info.Name, user)
|
grantStr := fmt.Sprintf("grant all privileges on `%s`.* to %s with grant option;", info.Name, user)
|
||||||
if info.Name == "*" {
|
if info.Name == "*" {
|
||||||
grantStr = fmt.Sprintf("grant all privileges on *.* to %s", user)
|
grantStr = fmt.Sprintf("grant all privileges on *.* to %s with grant option;", user)
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(info.Version, "5.7") || strings.HasPrefix(info.Version, "5.6") {
|
if strings.HasPrefix(info.Version, "5.7") || strings.HasPrefix(info.Version, "5.6") {
|
||||||
grantStr = fmt.Sprintf("%s identified by '%s' with grant option;", grantStr, info.Password)
|
grantStr = fmt.Sprintf("%s identified by '%s' with grant option;", grantStr, info.Password)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user