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

Okan Demirmen okan
Wed Nov 9 16:08:17 EST 2005


On Wed 2005.11.09 at 15:53 -0500, csnyder wrote:
> 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'

yea. i'm using all sorts of aliases...keeping them in sync with "mysql",
"mysqldump", "mysqladmin", etc becomes a pain...hence i wanted some of
it in .my.cnf file(s).

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

most cases, except backup dumps ;(

okan




More information about the talk mailing list