ubuntuusers.de

mysql error: logrotate

Status: Ungelöst | Ubuntu-Version: Ubuntu 18.04 (Bionic Beaver)
Antworten |

paine_one

Anmeldungsdatum:
6. November 2018

Beiträge: 27

Hallo liebe Community.

Ich bekomme seit 2 Tagen folgenden Fehler per Mail:

/etc/cron.daily/logrotate:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
error: error running shared postrotate script for '/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

Darauf hin habe ich per google nach einer Lösung gesucht und bin auf folgendes gestoßen:

What's happening is that after all the mysql backing up and everything is done, ubuntu is trying to use the debian-sys-maint user to flush the logs, this is actually called in /etc/logrotate.d/mysql-server. On my system, we seem to have lost this mysql user.

The solution is to look for the password used in the /etc/mysql/debian.cnf file, mine looks like this:

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = xxxxxxxxxxxxxxxx
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
user     = debian-sys-maint
password = xxxxxxxxxxxxxxxx
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr
Using the password, and some inspiration from this post on the Ubuntu Forums I recreated the user with the necessary permissions and password with:

GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY PASSWORD 'xxxxxxxxxxxxxxxx'
This did the trick, as the nightly errors have now disappeared from my script. Hope this helps someone in a similar situation - if you can expand these notes then please add a comment and I will update this as needed - thanks :)

generell lese ich auch in anderen Lösungen immer von dem User: "debian-sys-maint". in meiner debian.cnf steht aber als Benutzer "root" und das password feld ist leer...

ich habe nun einfach per Plesk (ich nutze einen Vserver von Strato) meine mysql datenbank geöffnet, und bei den benutzern nachgeschaut was da steht...

da steht nur admin, und meine angelegten user drin, und ein paar andere dessen funktion ich nicht weiss (denke ist von Plesk selbst) aber da steht nix von einem root oder debian-sys-maint ...

ich habe nun einen neuen user namens root angelegt @localhost, mit allen rechten und einem passwort. dieses passwort habe ich in der debian.cnf auch eingegeben und gespeichert...

ist der fehler nun behoben? wie kann ich das testen? habe ich es richtig gemacht oder wäre eine andere lösung besser gewesen?

Danke fü eure Hilfe

Antworten |