Learning to use Perl DBI, with MySql.
Need to do the equivalent of this command
/usr/local/mysql/bin/mysql -u root -p
In a Perl Script.
Here is the script I am using:
use strict;
use warnings;
use v5.10; # for say() function
use DBI;
my $dsn = "DBI:mysql:youtube_data_tmp:localhost";
my $username = "root";
my $password = '';
say "Perl MySQL INSERT Demo";
my %attr = (PrintError=>0,RaiseError=>1 );
my $dbh = DBI->connect($dsn,$username,$password,\%attr);
The error I keep getting is:
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module)
When I try to download DBD::mysql from CPAN I keep getting this error:
The bundle file "/Users/Zhiang/.cpan/Bundle/DBD/mysql.pm" may be a broken bundlefile. It seems not to contain any bundle definition. Please check the file and if it is bogus, please delete it. Sorry for the inconvenience.
I am really lost, and have know idea where to go from here. Is this a Perl script problem or an issue with the module ?