0

I know mysql client reads its options from .my.cnf in the groups [client] and [mysql]. I have other programs which use different groups and I would like to use those same groups (e.g. [appgroup]) instead of the default ones to reproduce the same connection options and act interactively as if it was the program connecting. Is there a way to do that?

Example config file:

[client]
user ...
pass ...

[appgroup]
user ...
pass ...
0

If I understand you correctly you want to use different config files for mysql client. You can do this with command:

mysql --defaults-file=config1.cnf <other parameters>

In this case the client will read only this files AND .mylogin.cnf (usually located in your home directory)

4
  • I want to use a different section in the same file. I programmatically do that for the application and I want to have the client use that same section – a1an Mar 31 '20 at 14:13
  • @a1an, I do not get, same section or different? You can have both by using different config files and use above way – Romeo Ninov Mar 31 '20 at 14:34
  • Same file, different section (or group as they call it). – a1an Apr 1 '20 at 12:32
  • @a1an, I do not think you can do this. \Just consider to use different file – Romeo Ninov Apr 1 '20 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.