0

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

4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by punitdam
0

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});
0

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.