|No such thing as a small change|
Connecting to mysql using DBI and a non-standard socketby logan (Curate)
|on Jul 05, 2005 at 19:34 UTC||Need Help??|
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".
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')
I get the following error:
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.