~/.my.cnf not read in Ubuntu 20.04 and MariaDB 10.3.22

Ken D'Ambrosio ken at jots.org
Tue Sep 8 13:18:02 UTC 2020


On 2020-09-08 08:57, Lentes, Bernd wrote:
> Hi,
> 
> i want to edit a .my.cnf file in /root for dumping the database with
> cron and not being
> asked for user and password.
> For that i need a user and a password entry in /root/.my.cnf
> That's what i have:
> 
> [client]
> user=root
> password=**********
> 
> But it seems that mysql does not read the file.
> mysql --help shows that the cnf files should be read:
> Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
> 
> Usage: mysql [OPTIONS] [database]
> 
> Default options are read from the following files in the given order:
> /etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf  <===============
> 
> But when i start mysql i'm still asked for user and password.
> And "stat" shows that the .my.cnf has not been touched.
> I mounted that partition with strictatime so each read should update
> the time of an access.

File permissions, maybe?  I see it should be set to 600, and the file, 
itself, would not need to be accessed to check the metadata on it.

-Ken




More information about the ubuntu-users mailing list