My code ran fine on Redhat linux. I was able to connect tot he same version of MYSQL: 3.23.

The code is now running on FreeBSD 4.8. The code is fine, but I cannot connect to the DB. I have installed the DBD and the dbi driver, before I pull my hair out, I seek the wisdom of the monks to point me in the right direction.

Error Message

install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC +contains: /usr/local/lib/perl5/5.8.7/i386-freebsd /usr/local/lib/perl +5/5.8.7 /usr/local/lib/perl5/site_perl/5.8.7/i386-freebsd /usr/local/ +lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl/5.6.2 /usr/l +ocal/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl .) at ( +eval 10) line 3. Perhaps the DBD::mysql perl module hasn't been fully installed, or perhaps the capitalisation of 'mysql' isn't right. Available drivers: ADO, ExampleP, Multiplex, Proxy. at /usr/local/apache/cgi-bin/ISee/ISeeSupportDisplaySWAT.pl line 164

code generating message

my $dbh = DBI->connect("dbi:mysql:$DBName:$IP", "$db_user", "$db_passw +ord", {RaiseError => 0, PrintError => 0} ) or err_trap("Cannot connect to the database");

I tried adding an extra : in the code between dbi::mysql and was surprised to get the followinf error messahe

Can't connect(dbi::mysql:support: username password HASH(0x842cb58)), +no database driver specified and DBI_DSN env var not set at /usr/loca +l/apache/cgi-bin/ISee/ISeeSupportDisplaySWAT.pl line 163

Any thoughts?

Am I using the wrong drivers? ----- 11jan06: Update. First, thanks again for your comments. It's nice to have a second voice over my shoulder.

On Linux, I used ppm, but could not find it on Unix, however, I did find MCPAN and used it to properly set up DBD abd DBI. Here is what I used:

perl -MCPAN -e 'install DBI' perl -MCPAN -e 'install DBD::mysql'

So thanks for the help, and I hope my update will assist others.

Signed, one of the faithful greatful ;)


In reply to Can't Connect to MySQL after port by sdyates

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.