Skip to content

Commit

Permalink
fix: mysql8_create_user_fix #5035
Browse files Browse the repository at this point in the history
  • Loading branch information
fanfanyangyang authored and jinquantianxia committed Jun 20, 2024
1 parent 90e0ae7 commit 0f417fa
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ func DiffVersionConvert(grants *[]string, mysql80Tomysql57, mysql57Tomysql56, my
// PrivMysql8 剔除txsql 8.0包含的动态权限
func PrivMysql8(grants *[]string) {
var tmp []string
regForCreateUser := regexp.MustCompile(
`(?i)^\s*CREATE USER `,
) // CREATE USER变为CREATE USER IF NOT EXISTS
// 8.0.30-txsql 包含的动态权限,但是开源版本不支持
var onlyForTxsql = []string{"READ_MASK"}
for _, item := range *grants {
Expand All @@ -320,6 +323,9 @@ func PrivMysql8(grants *[]string) {
if dynamicGrantsFlag == true {
continue
}
if regForCreateUser.MatchString(item) {
item = regForCreateUser.ReplaceAllString(item, `CREATE USER /*!50706 IF NOT EXISTS */ `)
}
tmp = append(tmp, item)
}
*grants = tmp
Expand Down

0 comments on commit 0f417fa

Please sign in to comment.