From 8c410b272d22024100c62b0258ebb342decb0825 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 25 Sep 2022 17:59:16 +0800 Subject: [PATCH] Update index.py --- plugins/mariadb/index.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/mariadb/index.py b/plugins/mariadb/index.py index 279e28813..8885a0ef4 100755 --- a/plugins/mariadb/index.py +++ b/plugins/mariadb/index.py @@ -363,6 +363,16 @@ def initMariaDbPwd(): pwd + ' -e "drop database test";' mw.execShell(drop_test_db) + # 删除冗余账户 + hostname = mw.execShell('hostname')[0] + drop_hostname = serverdir + '/bin/mysql --defaults-file=' + \ + myconf + ' -uroot -p' + pwd + ' -e "drop user \'\'@\'' + hostname + '\'";' + mw.execShell(drop_hostname) + + drop_root_hostname = serverdir + '/bin/mysql --defaults-file=' + \ + myconf + ' -uroot -p' + pwd + ' -e "drop user \'root\'@\'' + hostname + '\'";' + mw.execShell(drop_root_hostname) + pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,)) return True