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:
|
try:
|
||||||
WOMysql.execute(
|
WOMysql.execute(
|
||||||
self,
|
self,
|
||||||
"create user 'netdata'@'localhost';",
|
"DELETE FROM mysql.user WHERE User = 'netdata';",
|
||||||
log=False)
|
log=False)
|
||||||
WOMysql.execute(
|
WOMysql.execute(
|
||||||
self,
|
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)
|
log=False)
|
||||||
WOMysql.execute(
|
WOMysql.execute(
|
||||||
self, "flush privileges;",
|
self, "flush privileges;",
|
||||||
|
|||||||
@@ -108,17 +108,13 @@ class WOMysql():
|
|||||||
if dbs == "":
|
if dbs == "":
|
||||||
continue
|
continue
|
||||||
Log.info(self, "Backing up {0} database".format(dbs))
|
Log.info(self, "Backing up {0} database".format(dbs))
|
||||||
p1 = subprocess.Popen("/usr/bin/mysqldump {0}"
|
p1 = subprocess.Popen(
|
||||||
" --max_allowed_packet=1024M"
|
"/usr/bin/mysqldump {0} --max_allowed_packet=1024M "
|
||||||
" --single-transaction".format(dbs),
|
"--single-transaction ".format(dbs),
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
stderr=subprocess.PIPE, shell=True)
|
p2 = subprocess.Popen(
|
||||||
p2 = subprocess.Popen("/usr/bin/pigz -c > "
|
"/usr/bin/pigz -c > /var/lib/wo-backup/mysql/{0}{1}.sql.gz"
|
||||||
"/var/lib/wo-backup/mysql/{0}{1}.sql.gz"
|
.format(dbs, WOVar.wo_date), stdin=p1.stdout, shell=True)
|
||||||
.format(dbs, WOVar.wo_date),
|
|
||||||
stdin=p1.stdout,
|
|
||||||
shell=True)
|
|
||||||
|
|
||||||
# Allow p1 to receive a SIGPIPE if p2 exits
|
# Allow p1 to receive a SIGPIPE if p2 exits
|
||||||
p1.stdout.close()
|
p1.stdout.close()
|
||||||
output = p1.stderr.read()
|
output = p1.stderr.read()
|
||||||
|
|||||||
Reference in New Issue
Block a user