I have this relative simple Perl code:
use DBI;
use strict;
my $database = "mydb";
my $hostname = "123.45.6.7";
my $port = "3306";
my $user = "user";
my $password = "mypasss";
my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
my $dbh = DBI->connect( $dsn, $user, $password )
or die "Can't connect to database: ", $DBI::errstr, "\n";
All the parameters seem to be OK, however when I try to execute it on my CentOS I get this error:
DBI connect('database=mydb;host=123.45.6.7;port=3306','user',...) failed: Can't connect to MySQL server on '123.45.6.7' (110) at connection.pl line 17.
What am I doing wrong?