2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-01-23 23:28:27 +00:00

Merge pull request #222 from revant/fix-restore-backup

fix: restore backup grant privileges command
This commit is contained in:
Revant Nandgaonkar 2020-04-29 22:56:56 +05:30 committed by GitHub
commit b6b8afe415
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(