#!usr/bin/perl use strict; use warnings; use DBI; use DBD::Proxy; use DBD::mysql; # Configuration options to connect my %config = ( host => 'xx.xx.xx.xx', port => #####, driver => 'mysql', database => 'xxx', user => 'xxx', auth => xxxxxxxxxxxxxxxxxx, ); # Create Data Source $ENV{DBI_AUTOPROXY} = "hostname=$config{host};port=$config{port};"; my $dsn = "DBI:mysql:database=xxx"; # Connect / Create database handle my $dbh = DBI->connect( $dsn, $config{user}, $config{auth} ) || die $DBI::errstr; # Prepare query my $sth = $dbh->prepare('SHOW TABLES'); # Execute query and fetch results $sth->execute(); my $tables_ref = $sth->fetchall_arrayref(); # Works fine $dbh->disconnect;