diff --git a/install/mysqlUtilities.py b/install/mysqlUtilities.py index a1e3f95c3..a44261303 100755 --- a/install/mysqlUtilities.py +++ b/install/mysqlUtilities.py @@ -57,7 +57,10 @@ class mysqlUtilities: return 0 else: if remote: - dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (publicip) + if mysqlData['mysqlhost'].find('rds.amazon') == -1: + dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (publicip) + else: + dropDB = "GRANT SELECT, INSERT, DELETE ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (publicip) else: dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'localhost'" diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index 53e9e871b..424544de6 100755 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -26,6 +26,7 @@ import argparse class mysqlUtilities: LOCALHOST = 'localhost' + RDS = 0 @staticmethod def getPagination(records, toShow): @@ -67,6 +68,9 @@ class mysqlUtilities: mysqlport = jsonData['mysqlport'] mysqlhost = jsonData['mysqlhost'] + if mysqlhost.find('rds.amazon') > -1: + mysqlUtilities.RDS = 1 + ## Also set localhost to this server ipFile = "/etc/cyberpanel/machineIP" @@ -148,7 +152,12 @@ class mysqlUtilities: if connection == 0: return 0 - cursor.execute("GRANT ALL PRIVILEGES ON " + dbName + ".* TO '" + globalUser + "'@'%s'" % (mysqlUtilities.LOCALHOST)) + if mysqlUtilities.RDS == 0: + cursor.execute("GRANT ALL PRIVILEGES ON " + dbName + ".* TO '" + globalUser + "'@'%s'" % (mysqlUtilities.LOCALHOST)) + else: + cursor.execute("GRANT SELECT, INSERT, DELETE ON " + dbName + ".* TO '" + globalUser + "'@'%s'" % ( + mysqlUtilities.LOCALHOST)) + connection.close() return 1