I just verified that DBD::mysql overrides the values in the defaults file if they're passed to it. Here's what I did on 10.0.0.1 (test1.lab).
%> cat /tmp/my.cnf
[client]
socket = /var/lib/mysql/mysql.sock
user = root
%> cat dbdtest.pl
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use DBI;
my $dbh = DBI->connect('DBI:mysql:test:10.0.0.2:3306;mysql_read_default_file=/tmp/my.cnf;mysql_read_default_group=client', 'testuser', 'testpass') || die "Could not connect to database: $DBI::errstr";
my $sth = $dbh->prepare('SELECT @@hostname AS val');
$sth->execute();
my $result = $sth->fetchrow_hashref();
$sth->finish;
print "Value returned: $result->{val}\n";
$dbh->disconnect()
%> perl dbdtest.pl
Value returned: test2.lab
So, if this is the only concern, we should be good to go?
Hi Daniel!
I just verified that DBD::mysql overrides the values in the defaults file if they're passed to it. Here's what I did on 10.0.0.1 (test1.lab).
%> cat /tmp/my.cnf
[client]
socket = /var/lib/ mysql/mysql. sock
user = root
%> cat dbdtest.pl
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use DBI;
my $dbh = DBI->connect( 'DBI:mysql: test:10. 0.0.2:3306; mysql_read_ default_ file=/tmp/ my.cnf; mysql_read_ default_ group=client' , 'testuser', 'testpass') || die "Could not connect to database: $DBI::errstr"; 'SELECT @@hostname AS val'); hashref( );
my $sth = $dbh->prepare(
$sth->execute();
my $result = $sth->fetchrow_
$sth->finish;
print "Value returned: $result->{val}\n";
$dbh->disconnect()
%> perl dbdtest.pl
Value returned: test2.lab
So, if this is the only concern, we should be good to go?