From b55a6d3bd9cb3f4ae9676a3fb4909bd4a9d2d5ff Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 9 Jan 2023 23:31:00 +0800 Subject: [PATCH] Update index.py --- plugins/mysql/index.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 864cdb121..b206030de 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -488,14 +488,14 @@ def initMysql8Pwd(): # 删除冗余账户 hostname = mw.execShell('hostname')[0].strip() + if hostname != 'localhost': + drop_hostname = serverdir + '/bin/mysql --defaults-file=' + \ + myconf + ' -uroot -p' + pwd + ' -e "drop user \'\'@\'' + hostname + '\'";' + mw.execShell(drop_hostname) - 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) + 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,))