Code: Select all
my $dbUser = "user"; # the name of the mysql user that has read/write access to database $database
my $dbPassword = "pass"; # his password
my $database = "database"; # the used database
my $dbHostname = "host"; # mysql server
my $dbPort = "port"; # mysql server port
my $dsn = "DBI:mysql:database=$database;host=$dbHostname;port=$dbPort";
my $dbh;
$dbh = DBI->connect($dsn, $dbUser, $dbPassword) or die $dbh->errstr;