AHA! The httpd/error_log reports the following:
Sun Apr 15 01:12:49 2001 kk.pl: DBI->connect(Loader) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) at /usr/www/loader/cgi-bin/kk.pl line 26

So the problem is a sockets problem
(Question: why would a command prompt execution use a different socket from the apache execution??)

Using find / -name mysql.sock yields it in /var/lib/mysql/mysql.sock. Since this is not where the error is I looked to see how mysql is configured by typing mysqladmin version. This is the result:

mysqladmin Ver 8.18 Distrib 3.23.35, for pc-linux-gnu on i686 Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This software comes with ABSOLUTELY NO WARRANTY. This is free software +, and you are welcome to modify and redistribute it under the GPL licens +e Server version 3.23.35 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 29 min 46 sec Threads: 1 Questions: 1 Slow queries: 0 Opens: 6 Flush tables: 1 +Open tables: 0 Queries per second avg: 0.001

Clearly the server is configured correctly, so the problem must be one step pack, in the DBI or the DBD::mysql

I'm still hunting for where the /tmp/mysql.sock is specified, but I thought I'd give you this update.


In reply to Re: Perl Script connecting to Mysql works from command prompt, not from Apache by gary kuipers
in thread Perl Script connecting to Mysql works from command prompt, not from Apache by gary kuipers

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.