mysqladmin이 "오류" 메시지를 생성합니다.

mysqladmin이 "오류" 메시지를 생성합니다.

얼마 전 Raspbian을 실행하는 Raspberry Pi에 NGINX, php7, mariaDB 및 Wordpress를 설치했습니다.

나는 Wordpress 데이터베이스를 만들었습니다. 작동 중입니다.

최근에 메일을 보내기 위해 시스템을 ssmtp설치 했습니다 .mailutils

이제 다음 오류가 포함된 이메일을 매일 받습니다.

/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

이것은 약간 짜증나는 일입니다. 파일이 없습니다/var/log/mysql/mysql.log

mysql의 루트 사용자에게는 비밀번호가 있습니다.

오류 메시지를 표시하지 않으려면 어떻게 해야 합니까?

편집하다


/etc/cron.daily/logrotate전화/etc/logrotate.conf

포함하는

# rotate log files weekly
weekly
# packages drop log rotation information into this directory
include /etc/logrotate.d

이는 다음을 포함합니다

/etc/logrotate.d/mysql-server

# - I put everything in one block and added sharedscripts, so that mysql gets
#   flush-logs'd only once.
#   Else the binary logs would automatically increase by n times every day.
# - The error log is obsolete, messages go to syslog now.
/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log {
    daily
    rotate 7
    missingok
    create 640 mysql adm
    compress
    sharedscripts
    postrotate
          test -x /usr/bin/mysqladmin || exit 0
          if [ -f `my_print_defaults --mysqld | grep -m 1 -oP "pid-file=\K.+$"` ]; then
            # If this fails, check debian.conf!
            mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log \
              flush-engine-log flush-general-log flush-slow-log
          fi
    endscript
}

/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

답변1

  • mysql/mariadb 클라이언트로 가서 다음을 확인하세요.데비안 시스템 유지 관리비밀번호가 비어 있는 사용자가 이미 있습니다.사용자테이블mysql데이터 베이스

  • 기본값은 다음 /etc/mysql/debian.cnf을 포함해야 합니다데비안 시스템 유지 관리~처럼사용자대신에뿌리

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password =
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password =
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

관련 정보