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

**URL:** https://forums.percona.com/t/how-to-provide-user-password-for-various-percona-tools-using-config-file/7023
**Category:** Percona Toolkit
**Created:** [May 20, 2019, 4:38am UTC](https://forums.percona.com/t/how-to-provide-user-password-for-various-percona-tools-using-config-file/7023 "2019-05-20T04:38:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![avi\_vainshtein](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@avi\_vainshtein](https://forums.percona.com/u/avi_vainshtein)
#### Post date: [May 20, 2019, 4:38am UTC](https://forums.percona.com/t/how-to-provide-user-password-for-various-percona-tools-using-config-file/7023/1 "2019-05-20T04:38:42Z")

</div>

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

---

<div class="post-metadata">

### Author: ![brd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/brd/32/1313_2.png) [@brd](https://forums.percona.com/u/brd)
#### Post date: [April 24, 2020, 6:21am UTC](https://forums.percona.com/t/how-to-provide-user-password-for-various-percona-tools-using-config-file/7023/2 "2020-04-24T06:21:42Z")

</div>

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

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

```

Using the group **client** :

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

```
