谢谢回复,本地是可以链接的

On 01/30/2013 08:38 AM, Li, Zhen wrote:
Hi,

建议先确认一下,
使用你在下面perl代码中的user/password,
本地是否可以直接访问mysql.

如果确认可以访问,再调试dbi.

加油

2013/1/30 Haiyan Lin <[email protected]>:
大家好,

我用Apache+Mod_perl +MySQL +Mason的时候碰到一个问题,请问大家,改如何解 决。谢谢。

用DBI链接MySQL,在命令行执行没问题,但在Apache环境中用Mod_perl执行,报错
Can't connect to local MySQL server through socket '/tmp/mysql.sock'

代码如下

#!/usr/bin/perl
use DBI;
my $dbh =
DBI->connect("dbi:mysql:host=localhost:datase=seedBase:mysql_socket=/tmp/mysql.sock",'user','password',
{'RaiseError' => 1}) or die $!  ;

print "Content-type: text/plain\n\n";
print "mod_perl 2.0 rocks! \n";

去掉DBI链接的语句后,通过Apache环境中用Mod_perl执行下面的,也很正常,
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "mod_perl 2.0 rocks! \n";

祝各位顺利抢到火车飞机票,想去哪儿,就去那儿。

海艳


--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。





--
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。


回复