[nycbug-talk] mysql client and .my.cnf

csnyder chsnyder
Wed Nov 9 15:53:20 EST 2005


On 11/9/05, Okan Demirmen <okan at demirmen.com> wrote:
> hi all -
>
> so i'm curious as to how other people deal with ~/.my.cnf and multiple
> hosts/databases/usernames. for example i have:
>
> hostname=db01.example.com
> database=my_first_database
> username=first_database_user
>
> hostname=db02.example.com
> database=my_next_database
> username=next_database_user
>
> hostname=db99.example.com
> database=my_other_database
> username=other_database_user
>
> ...etc...
>
> now, i'd *love* to see an ssh_config(5) style to .my.cnf (or heck if
> mysql likes this ini style, then something like isakmpd.conf(5) would
> work too), but for now i'm using multiple .my.cnf.${db} files with the
> relevant info and shell aliases for each and such...i don't like it much
> - kinda messy...
>
> what does everyone else do?
>
> cheers,
> okan

Are you just looking for a way to avoid specifying the host, user, and
database name switches each time you connect via MySQL Client?

Would shell aliases work better?

alias db01='mysql -h db01.example.com -u first_database_user -p
my_first_database'

(That's assuming you use a password (-p) to connect...)

--
Chris Snyder
http://chxo.com/



More information about the talk mailing list