From ed70d4faa345529557dee8fc03bfc099a9d63be1 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 18 Dec 2023 21:41:26 +0800 Subject: [PATCH] Update index.py --- plugins/mysql/index.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index e11d884fb..70a12c081 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -1347,6 +1347,7 @@ def setRootPwd(version=''): return data[1] password = args['password'] + pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,)) try: pdb = pMysqlDb() result = pdb.query("show databases") @@ -1362,10 +1363,8 @@ def setRootPwd(version=''): pdb.execute( "ALTER USER 'root'@'127.0.0.1' IDENTIFIED BY '%s'" % password) else: - result = pdb.execute( - "update mysql.user set Password=password('" + password + "') where User='root'") + result = pdb.execute("update mysql.user set Password=password('" + password + "') where User='root'") pdb.execute("flush privileges") - pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,)) return mw.returnJson(True, '数据库root密码修改成功!') except Exception as ex: return mw.returnJson(False, '修改错误:' + str(ex))