# $HOME/.my.cnf
# Here are some general options
[client]
socket=/tmp/mysql.sock
port=3306
# the following are specific to each application
[mysqldump]
user=dumpuser
password=not_my_pwd
[backup]
user=bkpuser
password=not_my_real_one
[usage]
user=simpleguy
password=not_this_one
[readonly]
user=poorguy
password=don_t_try_it
[myapp]
user=specialguy
password=something_different
####
my $dbh = DBI->connect("DBI:mysql:test"
. ";mysql_read_default_file=$ENV{HOME}/.my.cnf"
.';mysql_read_default_group=myapp',
undef,
undef
) or die "something went wrong ($DBI::errstr)";
##
##
my $profile = shift || 'usage';
my $dbh = DBI->connect("DBI:mysql:test"
. ";mysql_read_default_file=$ENV{HOME}/.my.cnf"
.";mysql_read_default_group=$profile",
undef,
undef
) or die "something went wrong ($DBI::errstr)";