请教,perl不能连接mysql的问题

请教,perl不能连接mysql的问题

用客户端:
mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23 to server version:

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
可以正常连接

用php:
php -r "var_dump(mysql_connect('localhost','root',''));"
resource(4) of type (mysql link)
也可以正常连接


用perl:
perl -e "use DBI;DBI->connect('DBI:mysql:database:bds;host=localhost','root','');"
DBI connect('database:bds;host=localhost','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at -e line 1


请问各位大侠 是什么原因,并如何解决呢

续:
/var/lib/mysql/mysql.sock  这个路径是不对的,我的sock文件在 /tmp/下
那么 如何配置perl,让他去/tmp/下面找那个mysql.sock文件呢?
在/var/lib/mysql/建了一个link,暂时解决了问题
还是希望能得到有益的指点
我想看下你的my.ini设置
我想请问楼主怎么安装DBD:;mysql 的啊?我用ppm安装了它,但是在DBI driver里面没有mysql?不知道怎么回事了?
为什么不看它的帮助啊,连接的时候可以指定的

[Copy to clipboard] [ - ]
CODE:
mysql_socket
As of MySQL 3.21.15, it is possible to choose the Unix socket that is used for connecting to the server. This is done, for example, with

    mysql_socket=/dev/mysql
Usually there's no need for this option, unless you are using another location for the socket than that built into the client.