21
votes

Install information:

Using DBI 1.608 (for perl 5.008009 on x86_64-linux) installed in /usr/local/lib/perl5/site_perl/5.8.9/x86_64-linux/auto/DBI/

error information:

[root@datacenterETL DBD-mysql-4.020]# perl ../testConnect.pl install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.9/x86_64-linux /usr/local/lib/perl5/5.8.9 /usr/local/lib/perl5/site_perl/5.8.9/x86_64-linux /usr/local/lib/perl5/site_perl/5.8.9 .) at (eval 3) line 3.

Perhaps the DBD::mysql Perl module hasn't been fully installed, or perhaps the capitalisation of 'mysql' isn't right.

5

5 Answers

56
votes

It looks like you're using Linux. In that case, you might find it easier to install a pre-packaged version of the module.

On a Red Hat derivative try yum install perl-DBD-mysql; on a Debian derivative try apt-get install libdbd-mysql-perl.

11
votes

Perhaps the DBD::mysql perl module hasn't been fully installed

...so install it.

cpan DBD::mysql

Or since you don't have internet access,

perl Makefile.PL
make
make test
make install

You'll need MySQL's development header files installed first, as per INSTALL

3
votes

any error related to DBD::mysql error has not installed fully. Please run the below code in super user permission.

apt-get install libdbd-mysql-perl
2
votes

As is was not able to comment (yet), I want to add something for the Mac Users. I hat to add the --force command to install the everything properly as i have no local mySQL installation for the tests to pass. /usr/bin/cpanm --force DBD::mysql worked for me. (Mac OS 10.9.2, Perl 5.12.4)

0
votes

I've been tried perl -MCPAN -e shell on my mac OSX 10.8.5, but this didn't work.

I tried sudo perl -MCPAN ..., but didn't work too. I changed my ~.bash_profile to include

LD_RUN_PATH=/usr/local/mysql-5.6.13-osx10.7-x86_64/lib export LD_RUN_PATH 
LD_LIBRARY_PATH=/usr/local/mysql-5.6.13-osx10.7-x86_64/lib export LD_LIBRARY_PATH 

lines, and I tried -MCPAN again, with and without sudo, but this didn't work too.

I read some posts and I tried "get Bundle::DBD::mysql" in -MCPAN command line to download it and install with Makefile. Then, I entered the ~./cpan/build directory and I did a Makefile, but the make command didn't work. I tried Makefile with --testuser and --testpassword that I just had been configure in mysql. I entered the site https://discussions.apple.com/thread/3932531?start=0&tstart=0&fb_source=message that is informed in README doc of ./cpan/bundle, but I already had all command line tools of xCode installed and didn't work for me too.

Why don't do sudo perl -MCPAN -e shell and to force to install Bundle::DBD::mysql? This worked well and I got the installation.