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?
You could use this https://dev.mysql.com/doc/refman/8.0/en/option-file-options.html#option_general_defaults-group-suffix
[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:
$ cat foohost.cnf
[client]
user=foouser
password=sdfasdf
host=foo.int.domain.com
Then $ pt-duplicate-key-checker --defaults-file=foohost.cnf
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>)