From f5aeb5664bbe84442cc0a8d9c6a9c10c4b4313be Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 2 Jan 2023 11:58:08 +0800 Subject: [PATCH] Update index.py --- plugins/mysql-yum/index.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/mysql-yum/index.py b/plugins/mysql-yum/index.py index c98ecbb60..144619e25 100755 --- a/plugins/mysql-yum/index.py +++ b/plugins/mysql-yum/index.py @@ -1814,17 +1814,18 @@ def addMasterRepSlaveUser(version=''): if isError != None: return isError - sql = "FLUSH PRIVILEGES;" - pdb.execute(sql) else: sql = "GRANT REPLICATION SLAVE ON *.* TO '" + username + \ "'@'%' identified by '" + password + "';" result = pdb.execute(sql) - result = pdb.execute('FLUSH PRIVILEGES;') isError = isSqlError(result) if isError != None: return isError + sql_select = "grant select,lock tables,PROCESS on *.* to " + username + "@'%';" + pdb.execute(sql_select) + pdb.execute('FLUSH PRIVILEGES;') + addTime = time.strftime('%Y-%m-%d %X', time.localtime()) psdb.add('username,password,accept,ps,addtime', (username, password, '%', '', addTime))