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

avi vainshteinavi vainshtein Contributor Participant
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

Comments

  • brdbrd Active Member Poster
    edited April 24
    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:
    [client] 
    user = ...
    password = ...

Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.