Plankton has asked for the wisdom of the Perl Monks concerning the following question:
Friends,
I don't know how use DBI to connect to a MySQL database that uses the default /var/lib/mysql/mysql.sock file. I can connect with the mysql command line client like so ...
... so I thought I could do the same sort of thing in mysq script ...$ mysql -u plankton -p --socket=/somewhere/mysql/mysql.sock
The script fails with this output:#perl -w ... my %attr = ( socket => '/somewhere/mysql/mysql.sock' ); my $dbh = DBI->connect( "dbi:mysql:$db:$server", $user, $pw, \%attr ); ...
I guess %attr is not the way to go? What should my connect statement look like?DBI connect( 'blah:localhost', 'blah', ... ) failed: Can't connect to +local MySQL server through socket '/var/lib/mysql/mysql.sock' ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I specify the MySQL socket file?
by trammell (Priest) on Feb 16, 2005 at 21:08 UTC | |
|
Re: How do I specify the MySQL socket file?
by CountZero (Bishop) on Feb 16, 2005 at 21:38 UTC | |
|
Re: How do I specify the MySQL socket file?
by Animator (Hermit) on Feb 16, 2005 at 21:28 UTC | |
|
Re: How do I specify the MySQL socket file?
by chanakya (Friar) on Feb 17, 2005 at 05:59 UTC | |
|
Re: How do I specify the MySQL socket file?
by Anonymous Monk on Nov 27, 2007 at 16:05 UTC |