replace localhost with remote mysql in case of rds

This commit is contained in:
Usman Nasir
2020-08-29 19:36:01 +05:00
parent eaaea859d2
commit f3fb93fbe0
2 changed files with 12 additions and 2 deletions

View File

@@ -929,8 +929,13 @@ skip-name-resolve
cursor.execute(
"CREATE USER '" + user + "'@'%s' IDENTIFIED BY '" % (mysqlUtilities.LOCALHOST) + password + "'")
cursor.execute(
"GRANT ALL PRIVILEGES ON " + database + ".* TO '" + user + "'@'%s'" % (mysqlUtilities.LOCALHOST))
if mysqlUtilities.RDS == 0:
cursor.execute(
"GRANT ALL PRIVILEGES ON " + database + ".* TO '" + user + "'@'%s'" % (mysqlUtilities.LOCALHOST))
else:
cursor.execute(
"GRANT INDEX, DROP, UPDATE, ALTER, CREATE, SELECT, INSERT, DELETE ON " + database + ".* TO '" + user + "'@'%s'" % (mysqlUtilities.LOCALHOST))
connection.close()
return 1