finish allow remote access for db user

This commit is contained in:
Usman Nasir
2020-07-17 00:12:09 +05:00
parent c553c03253
commit 7c67993655
7 changed files with 289 additions and 36 deletions

View File

@@ -793,6 +793,27 @@ password=%s
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[mysqlUtilities.changePassword]")
return 0
@staticmethod
def allowRemoteAccess(dbName, userName, remoteIP):
try:
connection, cursor = mysqlUtilities.setupConnection()
if connection == 0:
return 0
cursor.execute("use mysql")
cursor.execute("update db set Host='%s' where Db='%s'" % (remoteIP, dbName))
cursor.execute("update user set Host='%s' where user='%s'" % (remoteIP, userName))
connection.close()
return 1
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[mysqlUtilities.changePassword]")
return 0
@staticmethod
def fetchuser(databaseName):
try: