From 165672f9fde433c0d7cc1757638af2cec1718360 Mon Sep 17 00:00:00 2001 From: dami Date: Sun, 27 Jul 2025 16:22:51 +0800 Subject: [PATCH] Update index.py --- plugins/mysql/index.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 0a59e7334..c646be0a9 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -1502,10 +1502,12 @@ def setRootPwdForce(new_password,version=''): # 正常启动MySQL start(version) - time.sleep(1) + time.sleep(5) # 设置新密码 - mw.execShell(serverdir+f"/bin/mysql -u root -e \"ALTER USER 'root'@'localhost' IDENTIFIED BY '{new_password}'; FLUSH PRIVILEGES;\"") + cmd_newpass = serverdir+f"/bin/mysql -u root -e \"ALTER USER 'root'@'localhost' IDENTIFIED BY '{new_password}'; FLUSH PRIVILEGES;\"" + print("新密码",cmd_newpass) + mw.execShell(cmd_newpass) # 验证密码 cmd = serverdir+f"/bin/mysql -u root -p'{new_password}' -e 'SHOW DATABASES;'"