mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
Update index.py
This commit is contained in:
@@ -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;'"
|
||||
|
||||
Reference in New Issue
Block a user