Рубрики
*NIX информация

logrotate.service degraded

Проблема:

Падает демон logrotate

В логах
cd /var/log
grep -irns logrotate.service -C4
--------------------------------
daemon.log-13157-Jul  5 00:00:10 HOSTNAME systemd[1]: Reloaded The Apache HTTP Server.
daemon.log-13158-Jul  5 00:00:10 HOSTNAME logrotate[13606]: #007mysqladmin: connect to server at 'localhost' failed
daemon.log-13159-Jul  5 00:00:10 HOSTNAME logrotate[13606]: error: 'Access denied for user 'root'@'localhost' (using password: NO)'
daemon.log-13160-Jul  5 00:00:10 HOSTNAME logrotate[13606]: 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 '
daemon.log:13161:Jul  5 00:00:10 HOSTNAME systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
daemon.log:13162:Jul  5 00:00:10 HOSTNAME systemd[1]: logrotate.service: Failed with result 'exit-code'.
daemon.log-13163-Jul  5 00:00:10 HOSTNAME systemd[1]: Failed to start Rotate log files.
daemon.log-13164-Jul  5 00:00:12 HOSTNAME systemd[1]: Stopping User Manager for UID 1015...
daemon.log-13165-Jul  5 00:00:12 HOSTNAME systemd[13615]: Stopped target Default.
daemon.log-13166-Jul  5 00:00:12 HOSTNAME systemd[13615]: Stopped target Basic System.
--------------------------------

в файле /etc/mysql/debian.cnf нет юзера debian-sys-maint и пароль пуст
cat /etc# cat /etc/mysql/debian.cnf
--------------------------------
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = root
password = 
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = root
password = 
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr
--------------------------------





Решение:

https://qastack.ru/server/9948/what-is-the-debian-sys-maint-mysql-user-and-more


задать пароль пользователю debian-sys-maint:
!!! ВАШ_НОВЫЙ_ПАРОЛЬ_ДЛЯ_ЮЗЕРА_debian-sys-maint - придумываем
GRANT ALL PRIVILEGES on *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'ВАШ_НОВЫЙ_ПАРОЛЬ_ДЛЯ_ЮЗЕРА' WITH GRANT OPTION; FLUSH PRIVILEGES;
прописать логин и пароль debian-sys-maint  в файл:
vim /etc# cat /etc/mysql/debian.cnf
--------------------------------
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = ВАШ_НОВЫЙ_ПАРОЛЬ_ДЛЯ_ЮЗЕРА_debian-sys-maint
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = ВАШ_НОВЫЙ_ПАРОЛЬ_ДЛЯ_ЮЗЕРА_debian-sys-maint
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr
--------------------------------

Проверяем:
logrotate -v -f /etc/logrotate.d/mysql-server