MySQL uses connection and config parameters from a number of possible sources. The easiest way to find out where it is looking for config files is to run
$ mysql --help | grep cnf
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /Users/kkoehntopp/homebrew/etc/my.cnf ~/.my.cnf
As can be seen, my version of the MySQL client checks in this order
- /etc/my.cnf
- /etc/mysql/my.cnf
- /Users/kkoehntopp/homebrew/etc/my/cnf
- ~/.my.cnf
The cnf file is a file in dot-ini syntax, so you have
[groups]
and each group contains lines with
key = value
pairs. Which groups are read?
$ mysql --help | grep "groups are"
The following groups are read: mysql client
So in my case, I would create a
/Users/kkoehntopp/.my.cnf
looking like this:
[client] …
[Read more]