From 000de62093fe17ebb8082b70b85509cf3fa6757b Mon Sep 17 00:00:00 2001 From: dami Date: Sun, 27 Jul 2025 16:09:05 +0800 Subject: [PATCH] Update index.py --- plugins/mysql/index.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 61a211c62..5764bdb34 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -1485,8 +1485,8 @@ def setRootPwdForce(new_password,version=''): time.sleep(1) serverdir = getServerDir() - # 启动安全模式 + # 启动安全模式 cmd_msafe = serverdir+"/bin/mysqld_safe --skip-grant-tables --skip-networking" print(cmd_msafe) safe_process = subprocess.Popen(cmd_msafe, @@ -1497,8 +1497,10 @@ def setRootPwdForce(new_password,version=''): # 等待MySQL安全模式启动... time.sleep(5) - mw.execShell(serverdir+"/bin/mysql -u root -e \"UPDATE mysql.user SET authentication_string = '' WHERE user = 'root'; FLUSH PRIVILEGES;\"") - + cmd_clear_root = serverdir+"/bin/mysql -u root -e \"UPDATE mysql.user SET authentication_string = '' WHERE user = 'root'; FLUSH PRIVILEGES;\"" + data = mw.execShell(cmd_clear_root) + print(data) + # 停止安全模式 safe_process.terminate() safe_process.wait()