Perl and mySQL
Posted by: gamiensrule
Posted on: 2009-09-26 10:06:00
I'm an experienced perl programmer but am just starting to learn mySQL. Can anyone help me with my connection string ? I'm not entirely sure how this works with dreamhost, so is something wrong here ?
sub connectDB
{
use DBI;
$DSN = "DBI:mysql:sqldbname";
$user = "user";
$pw = "pass";
$dbh = DBI->connect($DSN,$user,$pw)|| die "Cannot connect: $DBI::errstr\n" unless $dbh;
return;
}
when I run this I get the following error -
Software error:
Cannot connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
do i have to include the hostname in the connect string , and if so, what would that be ?
Sorry, I'm just new with mySQL.