Here's a hunch:
You upgraded MySQL recently.
Here's why I'm thinking this. The location of mysql's socket file is a
compile time option. You installed mysql, then installed DBD::mysql (or
Msql-Mysql-modules...). When the DBD drivers are compiled against the
mysql libraries, they get the location of the socket file. Installing a
new version of MySQL updates the mysql libraries (with a brand spanking
new socket file somewhere else, I don't know why they move it) confuses
DBD, because DBD is convinced it knows where the socket file is to be
found.
Solutions are:
* Reinstall DBD::mysql,
* recompile MySQL and specify the socket file location,
* start mysqld with a runtime option to put the socket file somewhere
else,
* specify the socket location in your dsn (
DBI::connect("DBI:mysql:mysql_socket=/var/lib/mysql/mysql.sock;database=...","","")
The last one is your only option if you don't have root access.
Peace,
Jamie
Jason Scharlach wrote:
>
> I'm trying to get a simple perl script to connect to a MySQL database
> via DBI:DBI. When I attempt to connect however I get the following
> error:
>
> DBI->connect(albatross) failed: Can't connect to local MySQL server
> through socket '/tmp/mysql.sock' (111) at ./test.pl line 71
> Can't connect to local MySQL server through socket '/tmp/mysql.sock'
> (111) at ./test.pl line 71.
>
> What confuses me is that /tmp/mysql.sock is NOT the socket that I have
> mysqld running on. When I do a 'mysqladmin variables' it shows that the
> socket is /var/lib/mysql/mysql.sock
> Why is the DBI interface attempted to connect to a non-existant socket
> when the actual daemon specifies the correct one? Any help would be
> greatly appriciated.
>
> Jason
--
-[sent-from-the-office]--------------------------------------------
| Programmer | |
| HBE Software, Inc. | email: [EMAIL PROTECTED] |
| http://www.hbesoftware.com | AIM : Reng8tak |
| (514) 876-7881 x259 | PGP : http://people.hbe.ca/~jamie |
-------------------------------------------------------------------
perl -le '@t=(32,73,84);print ref(sub{}).pack(c4,@t);'