1

I'm able to connect to a remote MySQL server from command line using

mysql -h "mysqlhost" -u user -ppasswd

But when I try to connect to the same server through perl script I get the below error:

DBI connect(.....)failed: Can't connect to MySQL server on 'mysqlhost' (111)

My code looks like this:

use DBI;
use DBD:mysql;
my $DBH = DBI->connect("DBI:mysql:database=DB1;host=mhsqlhost", "user", "passwd") ||   die "Connection Failed: $DBI::errstr";

Any inputs would be much appreciated!

Thanks a lot.

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190

0 Answers0