Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Perl5 and a custom MySQL4 install

by solarisfire (Novice)
on Jan 30, 2013 at 10:58 UTC ( #1016026=perlquestion: print w/ replies, xml ) Need Help??
solarisfire has asked for the wisdom of the Perl Monks concerning the following question:

I'm currently working on a pretty legacy system. Custom MySQL 4.1.22 (compiled from binary because it doesn't exist in repositories any more) installed on top of CentOS 6.3.

I installed perl5 to write a few management scripts to do tasks, have DBI installed from CPAN, but DBD::Mysql did not want to install via CPAN, so I manually grabbed the /lib/ folder from cpan.org and threw the files into /usr/lib64/perl5 myself.

But now I get the following error :(

install_driver(mysql) failed: Can't locate loadable object for module DBD::mysql in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 3) line 3 Compilation failed in require at (eval 3) line 3. Perhaps a module that DBD::mysql requires hasn't been fully installed at /foo.pl line 30

Line 30 is:

my $dbcon = DBI->connect('dbi:mysql:database', 'root', '') or die "Couldn't connect to database: " . DBI->errstr;

Any help would be greatly appreciated. Do I need to compile DBD::mysql myself pointing at the custom library locations?

Comment on Perl5 and a custom MySQL4 install
Download Code
Replies are listed 'Best First'.
Re: Perl5 and a custom MySQL4 install
by moritz (Cardinal) on Jan 30, 2013 at 11:02 UTC
    I installed perl5 to write a few management scripts to do tasks, have DBI installed from CPAN, but DBD::Mysql did not want to install via CPAN, so I manually grabbed the /lib/ folder from cpan.org and threw the files into /usr/lib64/perl5 myself.

    That won't work work, because DBD::mysql needs to compile some C/XS files. So yes, you need to compile your own DBD::mysql.

      How would I point it at the right libraries?
Re: Perl5 and a custom MySQL4 install
by Anonymous Monk on Jan 30, 2013 at 11:03 UTC

    Do I need to compile DBD::mysql myself pointing at the custom library locations?

    Yup, the auto/DBD/mysql.so file is missing, so yeah, you need to install/compile DBD::mysql,  cpan DBD::mysql or something like that, see A Guide to Installing Modules

Re: Perl5 and a custom MySQL4 install
by vinoth.ree (Prior) on Jan 30, 2013 at 12:07 UTC

    It seems the MySQL driver for the perl database interface (DBI) is missing.

    Can you also try this,

    check for DBD::mysql is installed or not by perl -e 'use DBD::mysql;'

    If there's no DBD::mysql module, you can do the following as root user:

    perl -MCPAN -e 'install DBD::mysql'

    (It will work if you have internet connection to connect with CPAN).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1016026]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (18)
As of 2015-07-31 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (278 votes), past polls