#!/usr/bin/perl -w use strict; use DBI; my $database = 'test'; my $username = 'username'; my $password = 'secret'; my $dbh=DBI->connect("dbi:mysql:$database", $username,$password, {RaiseError=>1}) or die "can't\n"; #if you get this far, you're connected # and you can list the tables in your db print "$_\n" for $dbh->tables; $dbh->disconnect();