# How are PT users managing multiple users/password?

**URL:** https://forums.percona.com/t/how-are-pt-users-managing-multiple-users-password/35010
**Category:** Percona Toolkit
**Created:** [November 13, 2024, 8:55pm UTC](https://forums.percona.com/t/how-are-pt-users-managing-multiple-users-password/35010 "2024-11-13T20:55:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![swfd](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@swfd](https://forums.percona.com/u/swfd)
#### Post date: [November 13, 2024, 8:55pm UTC](https://forums.percona.com/t/how-are-pt-users-managing-multiple-users-password/35010/1 "2024-11-13T20:55:26Z")

</div>

I work in an environment with dozens of MySQL instances, where local MySQL logins are in use, and each instance has a different username/password combination (unfortunately this is out of my control at the moment). How are other PT users handling situations like this without having to type the user and password each time they call one of the PT scripts?

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [November 13, 2024, 9:14pm UTC](https://forums.percona.com/t/how-are-pt-users-managing-multiple-users-password/35010/2 "2024-11-13T21:14:52Z")

</div>

You could use this [https://dev.mysql.com/doc/refman/8.0/en/option-file-options.html#option\_general\_defaults-group-suffix](https://dev.mysql.com/doc/refman/8.0/en/option-file-options.html#option_general_defaults-group-suffix)

```auto
[client_foohost]
host=foohost.int.domain.com
user=sdfd
password=sdfasdf

[client_barhost1]
host=barhost1.int.domain.com
user=asdf
password=32324

```

`$ mysql --defaults-group-suffix=_foohost`

Unfortunately, most PT tools don’t support this option. Instead, you’ll have to create individual cnf files for each host:

```auto
$ cat foohost.cnf
[client]
user=foouser
password=sdfasdf
host=foo.int.domain.com

```

Then `$ pt-duplicate-key-checker --defaults-file=foohost.cnf`

---

<div class="post-metadata">

### Author: ![swfd](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@swfd](https://forums.percona.com/u/swfd)
#### Post date: [November 13, 2024, 9:25pm UTC](https://forums.percona.com/t/how-are-pt-users-managing-multiple-users-password/35010/3 "2024-11-13T21:25:32Z")

</div>

Thanks for the response. I had already found that solution on a different forum but hoped there was something better than having to create a new file for each host.

At a previous job, I had a script that would echo ‘`--host=<my host> --user=<my user> --password=<my password>`’; it would retrieve the info from our local password DB, and I could call it like this:

`pt-somescript $(get_user_pass <myinstance>)`

or

`mysql $(get_user_pass <myinstance>)`
