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;'"