469,609 Members | 1,721 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC

I'm running OS X Snow Leopard on a MacBook Pro. I've installed Mysql using Macports. MySQL works fine, but I need to install the DBI module. I've tried several ways, but I always get the following error:

Expand|Select|Wrap|Line Numbers
  1. install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /Library/Perl/Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) at (eval 3) line 3.
  2. Perhaps the DBD::mysql perl module hasn't been fully installed,
  3. or perhaps the capitalisation of 'mysql' isn't right.
  4. Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
  5.  at /Users/peterv/Perl1/db.pl line 7
What I'd like to know is how to display what @INC contains, and how to set it to the correct values. I've searched everywhere I could think of and have found nothing. One guy suggested that @INC is a path (seems reasonable) that's not pointing to where the DBD/mysql.pm is. I really need to fix this, so any help debugging this will be really appreciated!
Apr 18 '10 #1
4 4108
3,503 Expert Mod 2GB
Did you try writing some code that uses DBI? Last time I checked, DBI was a core module that was distributed with Perl. You should not have to install it.

@INC is the Perl specific path variable that contains a list of the path's that Perl looks for modules. This is set at installation/compilation and cannot be changed.


Apr 19 '10 #2
Yes I did write a simple script using DBI, and it failed. I don't remember what the original error message was, since I've been installing & uninstalling things all weekend trying to get the thing to work. Currently, this is the error message I get:
Expand|Select|Wrap|Line Numbers
  1. peterv@MBP17.local<502>$: db.pl
  2. install_driver(mysql) failed: Can't locate loadable object for module DBD::mysql in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.10.1/darwin-multi-2level /opt/local/lib/perl5/site_perl/5.10.1 /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.10.1/darwin-multi-2level /opt/local/lib/perl5/vendor_perl/5.10.1 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.10.1/darwin-multi-2level /opt/local/lib/perl5/5.10.1 .) at (eval 3) line 3
  3. Compilation failed in require at (eval 3) line 3.
  4. Perhaps a module that DBD::mysql requires hasn't been fully installed
  5.  at /Users/peterv/Perl1/db.pl line 8
  7. Mon Apr 19 08:32:26 EDT 2010 
I installed the DBD module manually, according to the directions from CPAN, and, unfortunately, the Makefile.PL script they provide for installation has errors in it. I'm currently trying to debug that. I'm probably going to need help with it though, as I'm a novice perl programmer.
Apr 19 '10 #3
Can anyone help me debug this output? I've followed all the installation instructions to the letter, and I'm still getting this error:
Expand|Select|Wrap|Line Numbers
  1. peterv@MBP17.local<506>$: sudo Perl Makefile.PL | tee makefile.log
  2. tee: makefile.log: Permission denied
  7. For 'make test' to run properly, you must ensure that the 
  8. database user 'root' can connect to your MySQL server 
  9. and has the proper privileges that these tests require such 
  10. as 'drop table', 'create table', 'drop procedure', 'create procedure'
  11. as well as others. 
  13. mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';
  15. You can also optionally set the user to run 'make test' with:
  17. perl Makefile.pl --testuser=username
  19. Use of uninitialized value in printf at Makefile.PL line 175, <PIPE> line 102.
  20. I will use the following settings for compiling and testing:
  22.   cflags        (mysql_config) = -I/opt/local/mysql/include  -g -Os -arch x86_64 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL
  23.   embedded      (mysql_config) = 
  24.   libs          (mysql_config) = -L/opt/local/mysql/lib -lmysqlclient -lz -lm     -lmygcc
  25.   mysql_config  (guessed     ) = mysql_config
  26.   nocatchstderr (default     ) = 0
  27.   nofoundrows   (default     ) = 0
  28.   ssl           (guessed     ) = 0
  29.   testdb        (default     ) = test
  30.   testhost      (default     ) = 
  31.   testpassword  (default     ) = 
  32.   testsocket    (default     ) = 
  33.   testuser      (            ) = root
  35. To change these settings, see 'perl Makefile.PL --help' and
  36. 'perldoc INSTALL'.
  38. Multiple copies of Driver.xst found in: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/ /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/auto/DBI/ at Makefile.PL line 748
  39. Using DBI 1.608 (for perl 5.010000 on darwin-thread-multi-2level) installed in /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/
  40. Writing Makefile for DBD::mysql
  42. Mon Apr 19 09:43:29 EDT 2010 
  43. /Library/Perl/DBD-mysql-4.011 ->
  44. peterv@MBP17.local<507>$: db.pl
  45. install_driver(mysql) failed: Can't locate loadable object for module DBD::mysql in @INC (@INC contains: /opt/local/lib/perl5/site_perl/5.10.1/darwin-multi-2level /opt/local/lib/perl5/site_perl/5.10.1 /opt/local/lib/perl5/site_perl/5.8.9 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.10.1/darwin-multi-2level /opt/local/lib/perl5/vendor_perl/5.10.1 /opt/local/lib/perl5/vendor_perl /opt/local/lib/perl5/5.10.1/darwin-multi-2level /opt/local/lib/perl5/5.10.1 .) at (eval 3) line 3
  46. Compilation failed in require at (eval 3) line 3.
  47. Perhaps a module that DBD::mysql requires hasn't been fully installed
  48.  at /Users/peterv/Perl1/db.pl line 8
  50. Mon Apr 19 09:43:29 EDT 2010 
Is there some better way to install this DBD module? is there ANY way to successfully install this thing? PLEASE I need help!
Apr 19 '10 #4
Jeff, I'm still having massive problems with this. No matter how I install the DBI module, it's never in the @INC path. You said that that path is set upon installation. Is it set in the Perl installation? If so, would uninstalling Perl and resinstalling it reset it? Also, what's the best way to remove perl from OS X? If all else fails, I'm about ready to do a clean reinstall of OS X and start from scratch.
Apr 20 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by john townsley | last post: by
5 posts views Thread by HugoFromBOSS | last post: by
5 posts views Thread by scorpionbilli | last post: by
reply views Thread by Solution2021 | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.