MySQL and Logrotate

Discussion in 'Installation/Configuration' started by Bob White, Jan 24, 2017.

  1. Bob White

    Bob White Member

    I'm getting a daily message from the cron job for logrotate that's trying to swap the MySQL logs. I couldn't find anything in the forum about how to get rid of it. I can log in as the root user to the database, so I must have specified the password when I was setting up the database. I used the Ubuntu 16.04 Perfect Server script.
    /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​

    Does anyone know where to specify the password so it isn't a security problem? I tried creating /root/.my.cnf file with the credentials but that doesn't seem to work - it didn't work after I restarted mysql.
    Thanks,
    Bob
     
  2. Holger

    Holger New Member

    Did you found a solution? I have the same problem. I added the root password to /etc/mysql/debian.cnf but the login still fails.
     
  3. Bob White

    Bob White Member

    Adding the password into the debian.cnf file worked for me. There were two places to add it - I added it in both. Something worked!
    Bob
     
  4. Holger

    Holger New Member

    I tried this way too - but without success :(
     

Share This Page