I'm assuming that you really know of a specific mysql server that's running somewhere, and are really using the appropriate host, user and password parameters to connect to that. (It is of course totally appropriate and correct that you do not include that specific information in any post at PerlMonks.)

In my own access function for connecting to a mysql server, my dsn string goes like this:

$dsn = "DBI:mysql:database=test;host=host.name.dom"
I don't know if that'll make the difference in your case, but it works for me, and it's something that differs between my working code and your non-working code.

Apart from that, have you determined that you are able to connect to the database by other (non-perl) means -- e.g. can you run a mysql client from the command line and connect to that database using the given user/password/host/dbname values?

I also tend to set RaiseError to true, so if the connect fails, the script dies right away with an error message. You should at least check for success from the DBI "connect" call, if you're not going to set the RaiseError parameter.


In reply to Re: Timeout problems (DBI) by graff
in thread Timeout problems (DBI) by FireBird34

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.