indapa has asked for the wisdom of the Perl Monks concerning the following question:
But if I want to connect to my database in Perl via DBI with the following code:> mysql -h rat -u indapa -p
I get the following error when I run it:#!/user/bin/perl -w use strict; use DBI; my $dsn = 'dbi:mysql:genedb'; my $user = 'indapa'; my $password = '*****'; my $dbh = DBI->connect($dsn,$user,$password) or die $DBI:errstr, "\n";
I know there is a way to do this, but I can't seem to figure it out. Your help is appreciated.DBI connect('aindap','aindap',...) failed: Can't connect to local MySQ +L server through socket '/var/lib/mysql/mysql.sock' (2) at .//exon_qu +ery.pl line 31 Can't connect to local MySQL server through socket '/var/lib/mysql/mys +ql.sock' (2)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: connecting to MySQL on a different machine via DBI
by matija (Priest) on Mar 03, 2004 at 22:49 UTC | |
Re: connecting to MySQL on a different machine via DBI
by bart (Canon) on Mar 03, 2004 at 22:58 UTC | |
Re: connecting to MySQL on a different machine via DBI
by jockel (Beadle) on Mar 04, 2004 at 15:35 UTC |