Re: CentOS 8.2: error running non-shared postrotate script for /var/log/mysql/mysqld.log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



In article <CAADeyWiCwqYtdnkAkSkoKzmh8jmQobmCx6ehz0XOwJZB1HuFtg@xxxxxxxxxxxxxx>,
Alexander Farber <alexander.farber@xxxxxxxxx> wrote:
> Hello fellow CentOS users!
> 
> I have installed CentOS 8.2.2004 with the following packages:
> 
> mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
> mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
> mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
> mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
> 
> Then I have run mysql_secure_installation and among other things set the
> root password for MySQL
> 
> As result I am greeted with the following anachron mail every morning:
> 
> /etc/cron.daily/logrotate:
> 
>  mysqladmin: connect to server at 'localhost' failed
> error: 'Access denied for user 'root'@'localhost' (using password: NO)'
> error: error running non-shared postrotate script for
> /var/log/mysql/mysqld.log of '/var/log/mysql/mysqld.log '
> 
> I understand that the reason is me having set the root password for MySQL.
> 
> But my question is how to provide the password to postrotate without
> disclosing it too much?

Create a file .my.cnf owned by root with permission 600, containing these lines:

[mysqladmin]
user = root
password = YourMySqlRootPassword

You need to put it in / or in /root - I usually do both, as I think logrotate
has / as it's home dir instead of /root.

Then logrotate can call mysqladmin without having to give a password.

Cheers
Tony
-- 
Tony Mountifield
Work: tony@xxxxxxxxxxxxx - http://www.softins.co.uk
Play: tony@xxxxxxxxxxxxxxx - http://tony.mountifield.org
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux