From e1f0e62211b46954ca6d481381284b317f7bef88 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Wed, 29 Apr 2020 22:52:15 +0530 Subject: [PATCH] fix: restore backup grant privileges command --- build/common/commands/restore_backup.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/build/common/commands/restore_backup.py b/build/common/commands/restore_backup.py index be85fab8..29b0143f 100644 --- a/build/common/commands/restore_backup.py +++ b/build/common/commands/restore_backup.py @@ -78,17 +78,11 @@ def restore_database(files_base, site): ) os.system(create_user) - # create user password - set_user_password = mysql_command + "\"ALTER USER '{db_name}'@'%' IDENTIFIED BY '{db_password}'; FLUSH PRIVILEGES;\"".format( + # grant db privileges to user + grant_privileges = mysql_command + "\"GRANT ALL PRIVILEGES ON \`{db_name}\`.* TO '{db_name}'@'%' IDENTIFIED BY '{db_password}'; FLUSH PRIVILEGES;\"".format( db_name=site_config.get('db_name'), db_password=site_config.get('db_password') ) - os.system(set_user_password) - - # grant db privileges to user - grant_privileges = mysql_command + "\"GRANT ALL PRIVILEGES ON \`{db_name}\`.* TO '{db_name}'@'%'; FLUSH PRIVILEGES;\"".format( - db_name=site_config.get('db_name') - ) os.system(grant_privileges) command = "mysql -u{db_root_user} -h{db_host} -p{db_password} '{db_name}' < {database_file}".format(