From fc36666d272a33266952f42a1ee2e576079fd350 Mon Sep 17 00:00:00 2001 From: everyx Date: Tue, 24 Nov 2020 15:38:28 +0800 Subject: [PATCH] fix: make new command compatible with MySQL 8 --- build/common/commands/new.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/common/commands/new.py b/build/common/commands/new.py index d1452320..ade7e476 100644 --- a/build/common/commands/new.py +++ b/build/common/commands/new.py @@ -93,7 +93,10 @@ def main(): if config.get(RDS_DB) or site_config.get(RDS_DB): grant_privileges = RDS_PRIVILEGES - command = mysql_command + [f"GRANT {grant_privileges} ON `{db_name}`.* TO '{db_name}'@'%' IDENTIFIED BY '{db_password}'; FLUSH PRIVILEGES;"] + command = mysql_command + [f"\ + CREATE USER IF NOT EXISTS '{db_name}'@'%' IDENTIFIED BY '{db_password}'; \ + GRANT {grant_privileges} ON `{db_name}`.* TO '{db_name}'@'%'; \ + FLUSH PRIVILEGES;"] run_command(command) if frappe.redis_server: