logan has asked for the wisdom of the Perl Monks concerning the following question:
I've been bashing my head against this wall for two days and making no progress. I have a mysql database on a local Linux server and I'm trying to connect using DBI. The socket location is nonstandard. Instead of "/var/lib/mysql/mysql.sock", it's "/usr/kasenna/mysql/tmp/mysql.sock".
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
From the command line, I can connect using DBI:
mysql -S /usr/kasenna/mysql/tmp/mysql.sock -u root --password=password.
When I try to duplicate that using DBI:
my $dbh = DBI->connect('dbi:mysql:database=nemo;socket=/usr/kasenna/mysql/tmp/mysql.sock', 'nemo','password')
or
I get the following error:my %attr; $attr{socket} = "/usr/kasenna/mysql/tmp/mysql.sock"; my $dbh = DBI->connect('dbi:mysql:nemo', 'nemo', 'password', \%attr);
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I'm pretty sure that the problem stems from trying to pass the non-standard socket location, but I can't figure out how to pass that in the connect statement.
-Logan
"What do I want? I'm an American. I want more."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Connecting to mysql using DBI and a non-standard socket
by gellyfish (Monsignor) on Jul 05, 2005 at 19:42 UTC | |
by logan (Curate) on Jul 06, 2005 at 15:37 UTC | |
Re: Connecting to mysql using DBI and a non-standard socket
by Cody Pendant (Prior) on Jul 05, 2005 at 23:24 UTC | |
Re: Connecting to mysql using DBI and a non-standard socket
by Codon (Friar) on Jul 05, 2005 at 20:04 UTC | |
by gellyfish (Monsignor) on Jul 05, 2005 at 20:18 UTC | |
Re: Connecting to mysql using DBI and a non-standard socket
by shiza (Hermit) on Jul 05, 2005 at 20:58 UTC | |
by gellyfish (Monsignor) on Jul 05, 2005 at 21:16 UTC | |
by shiza (Hermit) on Jul 05, 2005 at 21:25 UTC |
Back to
Seekers of Perl Wisdom