简体   繁体   中英

How to fix install_driver(mysql) failed: Can't locate loadable object for module DBD::mysql in windows

I have the following issue on Windows 7.

install_driver(mysql) failed: Can't locate loadable object for module DBD::mysql in windows

I am using ActivePerl version 5.28 in my local set up.

When I print the drivers

 use DBI;

 my @ary = DBI->available_drivers();

It give below options.

CSV DBM ExampleP File Gofer Mem ODBC Oracle Pg Proxy SQLite Sponge mysql

Whereas I am getting the above error while connecting to mysql db.

I have installed DBI & DBD::mysql through cpan. These modules got installed inside cpan/build/DBI

I have copied down the lib folder inside this build to Perl installation lib folder.

Is there something wrong here? Have I missed some steps?

I don't know much about installing modules on Windows, but...

I have installed DBI & DBD::mysql through cpan. These modules got installed inside cpan/build/DBI

That's not the installation directory. That's an intermediate directory that cpan uses while building and installing a module.

I have copied down the lib folder inside this build to Perl installation lib folder.

You shouldn't need to do that. One of the reasons for using cpan is that it carries out all of the installation steps for you. If that hasn't happened then there were very likely some problems in the installation.

Is there a log file for the installation? Did you see any error messages?

install_driver(mysql) failed: Can't locate loadable object for module DBD::mysql in windows

This seems to imply that you don't have the MySQL client library installed. DBD::mysql uses this library to actually communicate with the database server. You might need to install the library from here .

It's also worth reading the DBD::msql installation guide . It says:

ActiveState Perl

ActivePerl offers a PPM archive of DBD::mysql. All you need to do is typing in a cmd.exe window:

 ppm install DBD-mysql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM