newbie question: using DBI, DBI::mysql

From: sstark_at_nospam.com ((sstark_at_nospam.com))
Date: 10/20/03

  • Next message: Andrew Shitov: "Re: newbie question: using DBI, DBI::mysql"
    Date: Mon, 20 Oct 2003 03:38:54 GMT
    
    

    Hi, I'm trying to get started using DBI and DBD::mysql to connect to an mysql database (of which I am the owner). When I run:

    ##################
    #! /usr/bin/perl
    use strict;

    use DBI;
    use DBD::mysql;

    # get variables...

    my $dbh=DBI->connect(
            'DBI:mysql:$database',
            $user,
            $password
    ) or die "\nError:\nCould not connect;\n"
            . $DBI::errstr . ";\nstopped";
    #######################

    I get this error:

    DBI->connect($database) failed: Can't connect to local MySQL server through sock
    et '/tmp/mysql.sock' (2) at ./m.pl line 15

    Error:
    Could not connect;
    Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2);
    stopped at ./m.pl line 15.

    Anything obvious about what I'm doing wrong here? Sorry if this is a dumb question.

    thanks
    Scott Stark
    sstark@hi-beam.net


  • Next message: Andrew Shitov: "Re: newbie question: using DBI, DBI::mysql"