Fix netdata mysql user in case of reinstall
This commit is contained in:
@@ -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;",
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user