diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 8237572..ddb6636 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -1410,11 +1410,15 @@ def post_pref(self, apt_packages, packages, upgrade=False): try: WOMysql.execute( self, - "create user 'netdata'@'localhost';", + "DELETE FROM mysql.user WHERE User = 'netdata';", log=False) WOMysql.execute( self, - "grant usage on *.* to 'netdata'@'localhost';", + "create user 'netdata'@'127.0.0.1';", + log=False) + WOMysql.execute( + self, + "grant usage on *.* to 'netdata'@'127.0.0.1';", log=False) WOMysql.execute( self, "flush privileges;", diff --git a/wo/core/mysql.py b/wo/core/mysql.py index 907a608..275a56a 100644 --- a/wo/core/mysql.py +++ b/wo/core/mysql.py @@ -108,17 +108,13 @@ class WOMysql(): if dbs == "": continue Log.info(self, "Backing up {0} database".format(dbs)) - p1 = subprocess.Popen("/usr/bin/mysqldump {0}" - " --max_allowed_packet=1024M" - " --single-transaction".format(dbs), - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, shell=True) - p2 = subprocess.Popen("/usr/bin/pigz -c > " - "/var/lib/wo-backup/mysql/{0}{1}.sql.gz" - .format(dbs, WOVar.wo_date), - stdin=p1.stdout, - shell=True) - + p1 = subprocess.Popen( + "/usr/bin/mysqldump {0} --max_allowed_packet=1024M " + "--single-transaction ".format(dbs), + stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + p2 = subprocess.Popen( + "/usr/bin/pigz -c > /var/lib/wo-backup/mysql/{0}{1}.sql.gz" + .format(dbs, WOVar.wo_date), stdin=p1.stdout, shell=True) # Allow p1 to receive a SIGPIPE if p2 exits p1.stdout.close() output = p1.stderr.read()