Search code examples
perlfreebsdmysql-connectordbidbd

FreeBSD Can't locate loadable object for module DBD::mysql


I installed DBD::mysql, but Perl does not recognize it:

root@bsd:~ # freebsd-version
13.0-RELEASE

root@bsd:~ # perl -v

This is perl 5, version 34, subversion 0 (v5.34.0) built for amd64-freebsd

Copyright 1987-2021, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

root@bsd:~ # perl -MDBD::mysql -el
Can't locate loadable object for module DBD::mysql in @INC (@INC contains: /usr/lib/perl5/site_perl/5.34.0/amd64-freebsd /usr/lib/perl5/site_perl/5.34.0 /usr/lib/perl5/5.34.0/amd64-freebsd /usr/lib/perl5/5.34.0) at -e line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.

root@bsd:~ # cpan CGI
Reading '/root/.cpan/Metadata'
  Database was generated on Thu, 26 Aug 2021 13:56:05 GMT
CPAN: Module::CoreList loaded ok (v5.20210520)
CGI is up to date (4.53).

root@bsd:~ # cpan DBD::mysql
Reading '/root/.cpan/Metadata'
  Database was generated on Thu, 26 Aug 2021 13:56:05 GMT
CPAN: Module::CoreList loaded ok (v5.20210520)
DBD::mysql is up to date (4.050).

Solution

  • I suggest you to install it from the ports tree - https://www.freshports.org/databases/p5-DBD-mysql/