I am trying to connect Mysql5.1 from Perl 5.8.8 on RHEL5 as follows:

$dsn="DBI:mysql:database=mysql";
$dbh=DBI->connect($dsn, 'root', 'root', 'mysql',{RaiseError => 1});

When I try to run perl containing above connection, it gets connected to Mysql and fetches data but displays following warning.

DBI->connect using 'old-style' syntax is deprecated and will be an error in future versions

What can be done to remove this warning?

Thanks and Regards

You need to remove the 'mysql' parameter from connect. Should look something like this:

use DBI;

$dsn="DBI:mysql:database=mysql";
$dbh=DBI->connect($dsn, 'root', 'root', {RaiseError => 1});

You need to remove the 'mysql' parameter from connect. Should look something like this:

use DBI;

$dsn="DBI:mysql:database=mysql";
$dbh=DBI->connect($dsn, 'root', 'root', {RaiseError => 1});

Thanks it is working fine now.

This question has already been answered. Start a new discussion instead.