DBI connect() failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

错误代码如下:

DBI connect('database=prcasys;host=localhost','prcasys',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at ./installdb line 41

解决办法:

进入perl脚本,在DBI->connect函数内加入正确的sock位置,比如:

DBI->connect("DBI:mysql:database=$database;mysql_socket=/usr/local/mysql/data/mysql.sock;host=$hostname",
        $username, $password,

解决之。

posted on 2012-07-18 00:27  百万军中  阅读(1251)  评论(0编辑  收藏  举报