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

Ahn asked:

Having the following error while trying to execute a perl script(For LVM backup). Seeing some DBD module is missing. How would I resole it ?

[root@localhost mylvmbackup-0.13]# ./mylvmbackup 
20120804 02:26:06 Info: Connecting to database...
Uncaught exception from user code:
        install_driver(mysql) failed: Can't locate DBD/ in @INC (@INC contains: /usr/share/mylvmbackup /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at (eval 17) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Proxy, Sponge.
 at ./mylvmbackup line 202
 at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/ line 756
        DBI::install_driver('DBI', 'mysql') called at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/ line 600
        DBI::connect('DBI', 'DBI:mysql:database=mysql;mysql_read_default_group=client', 'root', '') called at ./mylvmbackup line 202

When I tried to resolve it by installing perl-DBD-MYSQL it gives some conflict as well ?

yum install perl-DBD-MySQL
--> Finished Dependency Resolution
mysql-5.0.95-1.el5_7.1.x86_64 from updates has depsolving problems
  --> mysql conflicts with MySQL-server-community
Error: mysql conflicts with MySQL-server-community

My answer:

It appears you’ve installed incompatible RPM packages for MySQL from a third party source. Probably these came from Unfortunately they aren’t well integrated and cause problems like this.

Currently the best integrated current MySQL RPM packages that I’m aware of are those provided in the remi repository. Using these packages will prevent problems like this in future.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.