From d036f23f4a82610935b5df0471c5cd0fddb1e8da Mon Sep 17 00:00:00 2001 From: midoks Date: Fri, 4 Nov 2022 23:39:14 +0800 Subject: [PATCH] Update index.py --- plugins/mysql/index.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 21b5ffc48..a8d7d09ed 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -415,13 +415,19 @@ def initMysqlPwd(): # "UPDATE mysql.user SET password=PASSWORD('" + \ # pwd + "') WHERE user='root'" cmd_pass = serverdir + '/bin/mysql -uroot -e' - cmd_pass = cmd_pass + "\"UPDATE mysql.user SET password=PASSWORD('" + \ + cmd_pass = cmd_pass + \ + '"UPDATE mysql.user SET password=PASSWORD(' + \ pwd + "') WHERE user='root';" - cmd_pass = cmd_pass + "delete from user where USER='';flush privileges;\"" + cmd_pass = cmd_pass + 'flush privileges;"' data = mw.execShell(cmd_pass) # print(cmd_pass) # print(data) + # 删除空账户 + drop_empty_user = serverdir + '/bin/mysql -uroot -p' + \ + pwd + ' -e "delete from user where USER=''"' + mw.execShell(drop_empty_user) + # 删除测试数据库 drop_test_db = serverdir + '/bin/mysql -uroot -p' + \ pwd + ' -e "drop database test";'