DBD::mysql error in ActivePerl 5.28 on Windws10 64bits, Can't load mysql.dll

I installed the new ActiveState Perl custom build with Perl 5.28 and I added the module (DBD-mysql v4.50) and the DBI module.

This is just an upgrade from version Nothing else changed. I’m running existing scripts that work fine if I go back to this older version of ActivePerl.

Here is the error I get when executing the script:

install_driver(mysql) failed: Can't load 'C:/Perl64/site/lib/auto/DBD/mysql/mysql.dll' for module DBD::mysql: load_file:The specified module could not be found at C:/Perl64/lib/DynaLoader.pm line 193.
  at (eval 11) line 3.
Compilation failed in require at (eval 11) line 3.
Perhaps a required shared library or dll isn't installed where expected
 at C:\E22_TE~1\ICTDEV~1\Scripts\UPDATE~1.PL line 136.strong text

The file C:/Perl64/site/lib/auto/DBD/mysql/mysql.dll Exist

Any ideas?

I didn’t include any code since the module just does not load.

That looks like the system can’t find the MySQL client that the Perl DB driver dll needs for talking to the MySQL servers.

Perl gives that sort of error because it hands off to the system. If it has handed off to the system, and the system fails, the last known Perl statement is the only information Perl can give you.

You might have switched from a 32-bit 5.20 to a 64 bit 5.28, or you might have been using a different version of MySQL than what is needed now. 5.28 needs an exact match.

Make sure you have the 64-bit version of the library for mysql-5.7.16 installed, and on the $PATH where it can be loaded.

1 Like

i find its more 'stable’running ms visual code with sql/odbc driver then tho,the…

how did you fix it ? i have the same issue, using xampp too

there seem to be no answers for this problem. one user gave up and switched to linux, another had 32 vs 64 bit problem and said it was fixed but didn’t say how. i’ve installed on a new win10 system from an msi built on platform.activestate.com with DBI and DBD-mysql modules. > perl -e “use DBI”; gives no error but >perl -e “use DBD::mysql”; gives
Can’t load ‘C:/Perl64/site/lib/auto/DBD/mysql/mysql.dll’ for module DBD::mysql: load_file:The specified module could not be found at C:/Perl64/lib/DynaLoader.pm line 193.
at -e line 1.
Compilation failed in require at -e line 1.
BEGIN failed–compilation aborted at -e line 1.

i’m guessing that another module must be needed but can’t find any information about what module to add. i can connect to the database with mysql workbench, so i know that the connection parameters work. everything was working on an older version of Perl on a win7 computer that is to old and slow to continue life with.

I found a solution fot this issue on this link and its works

  1. Download Strawberry Perl from http://strawberryperl.com/
  2. Install it on your PC
  3. Find libmysql_.dll file from C:\strawberry\c\bin
  4. Copy it onto D:\xampp\perl\vendor\lib\auto\DBD\mysql

or just find a libmysql_.dll and move to you \lib\auto\DBD\mysql :smiley:

1 Like

Yes, what you did there is getting the matching version of the library, and putting on the $PATH where it can be loaded.

if there is a requirement for something to be installed outside of perl in order for this to work then why isn’t it at least documented? better, why doesn’t adding DBD-mysql add the necessary library for you? my latest builds are now all failing with an error adding DBD-mysql module - Reason: Builder returned with exit code 255.

my solution was to abandon activestate perl on windows completely and switch to the latest portable strawberry perl. it worked out of the box for mysql on the first try without any special build or adding any modules.

one other project that i have needed to access xbase files and the necessary module installed easily with cpanm DBD-XBase after installing cpan App::cpanminus. added 1 module and it worked flawlessly on first try.

my conclusion is that if you need to use perl on windows 10 64 bit, use strawberry perl not active state.

1 Like

Shipping third party database clients/drivers was not something that we used to do, but that’s all going to be changing/improving as we moved forward from Perl 5.32 onwards. The newer build system will supply the client without needing to install it separately. However, as mentioned above, the solution of installing the client and ensuring that the DLL is on your PATH will solve this issue in the immediate term.


how can I set a PATH or , how can i see what is the path ?

I haven’t been keeping up with this thread and even stated that the issue was resolved above (it was a mistake… it was not, I should remove that statement as it seems to have caused some problems) but this solution from danimera worked. Copying libmysql_.dll from Strawberry Perl to the C:\Perl64\site\lib\auto\DBD\mysql folder fixed my problem.