fix: mysql db commands with subprocess
This commit is contained in:
@@ -97,6 +97,10 @@ def main():
|
||||
|
||||
mysql_command = ["mysql", f"-h{db_host}", f"-u{mariadb_root_username}", f"-p{mariadb_root_password}", "-e"]
|
||||
|
||||
# Drop User if exists
|
||||
command = mysql_command + [f"DROP USER IF EXISTS '{db_name}'@'%'; FLUSH PRIVILEGES;"]
|
||||
run_command(command)
|
||||
|
||||
# update User's host to '%' required to connect from any container
|
||||
command = mysql_command + [f"UPDATE mysql.user SET Host = '%' where User = '{db_name}'; FLUSH PRIVILEGES;"]
|
||||
run_command(command)
|
||||
@@ -106,7 +110,7 @@ def main():
|
||||
run_command(command)
|
||||
|
||||
# Grant permission to database
|
||||
command = mysql_command + [f"GRANT ALL PRIVILEGES ON \`{db_name}\`.* TO '{db_name}'@'%'; FLUSH PRIVILEGES;"]
|
||||
command = mysql_command + [f"GRANT ALL PRIVILEGES ON `{db_name}`.* TO '{db_name}'@'%'; FLUSH PRIVILEGES;"]
|
||||
run_command(command)
|
||||
|
||||
if frappe.redis_server:
|
||||
|
||||
Reference in New Issue
Block a user