cfreak has asked for the wisdom of the Perl Monks concerning the following question:

This could be a MySQL admin problem but I'm not certain so I'm going to ask my question anyway. Apologies if its off-topic or just plain dumb.

I'm moving a whole bunch of sites from one company to another (long story) I have some Perl sites and some PHP. For some reason the Perl sites cannot connect to the database. They fail with "Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock'". The mysql server is running, and the PHP scripts work just fine. I can also use the command line client and get in (using the same username and password). What is weird is the file /var/run/mysql/mysql.sock doesn't exist, and I can't find mysql.sock on the system anywhere. I assumed that would break PHP scripts as well but this does not appear to be the case.

Can someone give me a clue? Thanks!!

Lobster Aliens Are attacking the world!

Replies are listed 'Best First'.
Re: DBI / MySQL weird connection problems
by cLive ;-) (Prior) on Oct 06, 2003 at 23:09 UTC
    looks like your mysql.sock is in a different location. Try your /tmp dir, or failing that, search for it.

    It must be there somewhere :)

    cLive ;-)

    Update: How hard did you look?

    mysql --print-defaults
      Hmmm, --print-defaults didn't tell me lots.   But, hey, your other suggestion of looking for it produced results when I used "locate mysql.sock".   On my system (RH7.2) I found it as /var/lib/mysql/mysql.sock , even though standard for MySQL seems to be /tmp/mysql.sock like you mentioned.   Ah, well...
Re: DBI / MySQL weird connection problems
by Anonymous Monk on Oct 06, 2003 at 23:39 UTC

    What's the connection line you are using with PHP?

    It could be that you're using the socket for Perl and a network connection with PHP.

Re: DBI / MySQL weird connection problems
by cfreak (Chaplain) on Oct 06, 2003 at 22:19 UTC
    Well since I seem to be getting downvotes rather than a bit of help here's some code, this code worked fine before this move:

    my $dbh = DBI->connect("DBI:mysql:host=localhost;database=xxxx",'xxxx +','xxxx') or die DBI->errstr();
    'xxxx' replacing real database, username and password to protect the innocent.

    And please, if you're going to downvote me, have the guts to tell me what for.

    /tired disgruntled admin signing off

    Lobster Aliens Are attacking the world!
Re: DBI / MySQL weird connection problems
by cfreak (Chaplain) on Oct 08, 2003 at 13:22 UTC