I think you're missing the server information in your script. If it's on the same machine as the mysql server then localhost would probably work fine.
ie my ($dsn) = "DBI:mysql:databasename:localhost"; my ($username) = "username"; my ($pass) = "password"; $dbh = DBI->connect ($dsn, $username, $pass, { RaiseError => 1 }); -shoe On Wed, 2002-07-17 at 11:27, Starman P wrote: > All > i wrote the following perl script and tried to connect to mysql database: > # File name fig13.pl > #!/usr/bin/perl -w > > use DBI; > > $dbh = DBI->connect("DBI:mysql:zipcodes","username","mypass"); > if ($dbh) { > print "Connection successful\n"; > } > > then after giving execute permission, i tried to run it by: > # perl fig13.pl > > I get error message: > DBI->connect(zipcodes) failed: Can't connect to local MySQL server through > socket '/var/lib/mysql/mysql.sock' (2) at ./fig13.pl line 5 > > zipcodes is the database i created in mysql. > When i manually type > # mysql -u username -p zipcodes > I get prompt for passwd and when i tyep it, it takes me to the mysql promt. > So mysql server is running and that user has permission to acces "zipcodes" > database. > What did i wrong or what can i do to make it work?? > > thanks for your help > > Pran > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > > _______________________________________________ > Redhat-list mailing list > [EMAIL PROTECTED] > https://listman.redhat.com/mailman/listinfo/redhat-list > _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list