Well, the first thing I would do is see if I can connect to the database from the commandline.You know:
mysql -u root -p
Since one of the databases in on your local machine, you should have no problem. If you cannot connect that way, then it is a MySQL issue. If you can connect that way, then its an error in the script. If it is an error in the script, then I would strip it down to the absolute essentials of something like this:
#!/usr/bin/perl use DBI; use strict; my $dbh; my $db='survey'; my $host='localhost'; my $user='root'; my $pw='whatever'; $dbh = DBI->connect("DBI:mysql:$db", $user, $pw) or die "Database conn +ection not made: $DBI::errstr"; print "Woo Hoo! I connected!\n"; exit;
If that works, then I would start rebuilding the cgi script from that point.

All that being said, my guess is that it is a problem with the script since it is unlikely that both MySQL servers you are trying to reach have problems.

By the way Nik, you really need to develop some basic troubleshooting skills.

just my 2 cents,
davidj

In reply to Re: Canot connect to the remote mysql server through those lines by davidj
in thread Canot connect to the remote mysql server through those lines by Nik

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.