Perl and mySQL

software development

#1

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.


#2

Nevermind…
I got it.

“Necessity may be the mother of invention, but trial and error is the mother of knowledge.”