How to provide user/password for various percona tools using config file ?

Greetings,

I want to use various Percona Toolkit tools without providing the user/password in the command line.
(The tools do work properly with user/password in the command line.)

I have a file which works fine for my mysql coomands.

cat credentials-root.cnf
[client]
user=“root”
password=“root321”

mysql --defaults-extra-file=/home/mysql/local/dbscript/credentials-root.cnf -e “select now()”
±--------------------+
| now() |
±--------------------+
| 2019-05-20 13:05:54 |
±--------------------+

However , when i try to use that file for Percona tools (like pt-mysql-summary, for example) - it doesn’t work :

pt-mysql-summary --defaults-file=/home/mysql/local/dbscript/credentials-root.cnf
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
2019_05_20_13_06_55 Cannot connect to MySQL. Check that MySQL is running and that the options after – are correct.

pt-mysql-summary --config=/home/mysql/local/dbscript/credentials-root.cnf
ERROR 1045 (28000): Access denied for user ‘mysql’@‘localhost’ (using password: NO)
2019_05_20_13_07_48 Cannot connect to MySQL. Check that MySQL is running and that the options after – are correct.

What am i doing wrong ?

Best regards,
Avi

You can specify the MySQL .cnf file with the DSN F specifier:

h=127.0.0.1,P=3366,F=./pt.cnf

Using the group client:

<code><code>[client] <br>user = ...<br>password = ...</code></code>