From 8135f0f59850f6fea2b3a34dcc5164ca55680cd5 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Wed, 16 Aug 2023 23:36:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#1974)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #1925 --- backend/utils/mysql/client/local.go | 4 +- backend/utils/mysql/client/remote.go | 4 +- frontend/src/routers/modules/database.ts | 10 ++++ frontend/src/views/database/mysql/index.vue | 23 ++------ .../views/database/mysql/setting/index.vue | 55 +++++++++---------- 5 files changed, 44 insertions(+), 52 deletions(-) diff --git a/backend/utils/mysql/client/local.go b/backend/utils/mysql/client/local.go index 0b3aa5916..ce2e3f9c3 100644 --- a/backend/utils/mysql/client/local.go +++ b/backend/utils/mysql/client/local.go @@ -147,7 +147,7 @@ func (r *Local) ChangePassword(info PasswordChangeInfo) error { for _, user := range userlist { passwordChangeSql := fmt.Sprintf("set password for %s = password('%s')", user, info.Password) if !strings.HasPrefix(info.Version, "5.7") && !strings.HasPrefix(info.Version, "5.6") { - passwordChangeSql = fmt.Sprintf("ALTER USER %s IDENTIFIED WITH mysql_native_password BY '%s';", user, info.Password) + passwordChangeSql = fmt.Sprintf("alter user %s identified by '%s';", user, info.Password) } if err := r.ExecSQL(passwordChangeSql, info.Timeout); err != nil { return err @@ -276,7 +276,7 @@ func (r *Local) SyncDB(version string) ([]SyncDBInfo, error) { From: r.From, Format: parts[1], } - userLines, err := r.ExecSQLForRows(fmt.Sprintf("SELECT USER,HOST FROM mysql.DB WHERE DB = '%s'", parts[0]), 300) + userLines, err := r.ExecSQLForRows(fmt.Sprintf("select user,host from mysql.db where db = '%s'", parts[0]), 300) if err != nil { return datas, err } diff --git a/backend/utils/mysql/client/remote.go b/backend/utils/mysql/client/remote.go index 131dff80e..7ab7354e0 100644 --- a/backend/utils/mysql/client/remote.go +++ b/backend/utils/mysql/client/remote.go @@ -263,7 +263,7 @@ func (r *Remote) Recover(info RecoverInfo) error { func (r *Remote) SyncDB(version string) ([]SyncDBInfo, error) { var datas []SyncDBInfo - rows, err := r.Client.Query("SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA") + rows, err := r.Client.Query("select schema_name, default_character_set_name from information_schema.SCHEMATA") if err != nil { return datas, err } @@ -283,7 +283,7 @@ func (r *Remote) SyncDB(version string) ([]SyncDBInfo, error) { MysqlName: r.From, Format: charsetName, } - userRows, err := r.Client.Query("SELECT USER,HOST FROM mysql.DB WHERE DB = ?", dbName) + userRows, err := r.Client.Query("select user,host from mysql.db where db = ?", dbName) if err != nil { return datas, err } diff --git a/frontend/src/routers/modules/database.ts b/frontend/src/routers/modules/database.ts index efdb36754..2fc320484 100644 --- a/frontend/src/routers/modules/database.ts +++ b/frontend/src/routers/modules/database.ts @@ -27,6 +27,16 @@ const databaseRouter = { requiresAuth: false, }, }, + { + path: 'mysql/setting', + name: 'MySQL-Setting', + component: () => import('@/views/database/mysql/setting/index.vue'), + hidden: true, + meta: { + activeMenu: '/databases', + requiresAuth: false, + }, + }, { path: 'mysql/remote', name: 'MySQL-Remote', diff --git a/frontend/src/views/database/mysql/index.vue b/frontend/src/views/database/mysql/index.vue index 26b4665fa..b2c3a6eea 100644 --- a/frontend/src/views/database/mysql/index.vue +++ b/frontend/src/views/database/mysql/index.vue @@ -11,7 +11,7 @@ > -