newbie: DBI mysql connection problem

From: Scott Stark (sstark_at_us.ibm.com)
Date: 04/19/04


Date: 18 Apr 2004 16:04:44 -0700

Hi, I'm new to the Perl DBI and am having a connection problem to
MySQL. Can anyone tell me what's happening and what I'm doing wrong?
=================
use strict;
use DBI;

## variables $database, $user and $password assigned here...

my $dbh = DBI->connect("DBI:mysql:database=$database;host=localhost",
                       "$user", "$password",
                       {'RaiseError' => 1});
=================

The error I receive:

DBI->connect(database=slugger415;host=localhost) failed: Can't connect
to local
MySQL server through socket '/tmp/mysql.sock' (2) at ./mm.pl line 12

Any help would be appreciated.

Scott



Relevant Pages

  • DBI w/Multiple mysql installed versions
    ... required that I set up on older mysql 3x version. ... original perl module install. ... require a reinstall of the perl DBI module which would be fine. ...
    (perl.dbi.users)
  • Stored procedure problem
    ... but I am asking here to not reinvent ... the wheel :-) ... In MySQL 5 you can use stored procedures, ... but when using perl DBI ...
    (perl.dbi.users)
  • Field terminated by
    ... I have a problem using special characters in the Perl DBI. ... SQL code works without problem with mysql: ... When I try to execute it from perl as follows, ... I guess this problem is related to the field terminated by ";" part of the command. ...
    (perl.dbi.users)
  • DBI cannot connect to mysql at a specified socket location
    ... then mysql's socket is located at /tmp/mysql.sock ... my perl dbi script can work well. ... But if I start the mysql daemon using the $HOME/.my.cnf file (it specifies ...
    (comp.lang.perl.misc)
  • Re: DBI & primary keys
    ... && I'm inserting a new record into a MySQL table using Perl DBI. ... Whether there might be a specific MySQL solution for this particular, ...
    (comp.lang.perl.misc)