gosseyn has asked for the wisdom of the Perl Monks concerning the following question:

Hi folks,
I'm coding under Windows because of my job requires it. I have for many years been using Active Perl, but it does not seam to be running anymore or maintained. By the way, I don't understand anything on their website (they don't speak about Perl). Everything was easy with Active Perl and PPM. But, Active Perl seamed obsolete and I moved to Strawberry Perl. And the things are not so easy.

Now, I have some scripts which used the DBI interface and the DBD::Mysql driver to read/write in a database managed by the MAMP software which was running very well on Windows for years. Now, after installing Strawberry Perl, some modules are not installed anymore. The easiest way I found to (re)install them is to use the "cpanm" utility. It is usually running smooth and pretty fast.

But the things were going wrong when trying to install and compile the DBD::Mysql module (driver) I need it for my scripts, in order to access the MySQL DBs. Here are the issues I had to deal with :

  1. The compilation failed because the Makefile couldn't get the Mysql configuration by calling the "mysql_config.pl" script provided by MAMP. I had to add the "bin" directory in the %PATH% system variable under Windows.
  2. I had to specify to Makefile.pl the "--mysql_config=mysql_config.pl" option to help to find the script, but the script does not seam to work well, it does not properly return values that you may call, for example by doing : "mysql_config.pl --version". It always return the %PATH% value.
  3. I made a specific "mysql_config.pl" script that I put in the build directory for Cpanm (C:\Users\me\.cpanm\work\workidxxx\Module-Name), very simple, that works when you call it with all available options, such as "--version". I have added some default values normally called by Makefile.pl, however without certainty of the right values to use.
  4. Then the compilation was refused because my MySQL version (5.47) was lesser than the minimum required by this version of the driver. I was advised to install the version 8 of MySQL, but 5.7 is considered as more stable. MAMP does not provide a version with MySQL 8. WAMP, yes, but I prefer MAMP.
  5. Alternatively, I have installed a package of MariaDB for Windows, but the compilation/installation of the DBD::MariaDB, based on DBD::Mysql, failed the same way. I have adapted the modifications I made for DBD::Mysql for MariaDB, so now, I'm focusing on installing/compiling the MariaDB driver, which seams also to be compatible with MySQL.

I'm at the point where, after running the Makefile.pl file with these options : "perl Makefile.pl --cflags="-IC:\Program Files\MariaDB 11.8\include\mysql" --libs="-LC:\Program Files\MariaDB 11.8\lib -lmysqlclient" --testdb=test --testuser=perl --mariadb_config=.\mariadb_config.pl", it cannot find the "mariadb_config.pl" which is located in the current directory :
"Specified mysql configuration script '.\mariadb_config.pl' doesn't exist. Please check path/permissions."

I'm stuck, now, and I can't use all my scripts connecting to the MySQL/MariaDB database now. If someone is good at this configuration and can help, I would be grateful. Thanks.

Gosseyn alias Alan. PS : I have managed to install the all stuff under darwin (MacOS X) with homebrew. Everything was running fine until I get to install DBD::MariaDB with Cpanm. It's a curse...
-- Gosseyn
  • Comment on Help on how to compile/install module DBD::MariaDB/Mysql on Windows using Strawberry Perl

Replies are listed 'Best First'.
Re: Help on how to compile/install module DBD::MariaDB/Mysql on Windows using Strawberry Perl
by choroba (Cardinal) on Jul 22, 2025 at 15:11 UTC
    Instead of using a relative path like .\mariadb_config.pl, try using the full path (e.g. c:\System\Roaming\Secret Folder\Apps\mariadb_config.pl). Also, if the path contains spaces, quoting might be needed.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Changing the call to "--mariadb_config="C:\Program Files\MariaDB 11.8\bin\mariadb_config.pl"
      I get the same kind of error : "Specified mysql configuration script 'C:\PROGRA~1\MariaDB 11.8\bin\mariadb_config.pl' doesn't exist.
      Please check path/permissions."
      Now that I have put the mariadb_config.pl into the 'C:\PROGRA~1\MariaDB 11.8\bin', which is on the path, I have ran the Makefile.pl without the "--mariadb_config" option, and it finds the script by itself. I have, then, another error :

      "Checking if libs and header files are available for compiling...
      Can't link/include C library 'windows.h', 'winsock.h', 'mysql.h', 'mysqlclient', aborting."

      However it finds the parameters from the mariadb_config.pl script :
      cflags (User's choice) = -IC:\Program Files\MariaDB 11.8\inc +lude\mysql libs (User's choice) = -LC:\Program Files\MariaDB 11.8\lib + -lmysqlclient requireembsup (default ) = 0 testauthplugin (default ) = testdb (User's choice) = test testembdatadir (default ) = testemboptions (default ) = testhost (default ) = testpassword (default ) = testport (default ) = testsocket (default ) = testuser (User's choice) = perl
      mysql.h is found in directory C:\Program Files\MariaDB 11.8\include\mysql, but not the other 3 required files. I don't where they can be...

      --
      Gosseyn
      Thanks Choroba,

      I have tried the full path, it doesn't work.
      I have also tried with double quotes, with just the name mariadb_config.pl without the directory "./" but it doesn't work. I have learned that the file must be in the PATH. On Windows, the current directory is always in the PATH. So I don't understand. Next step : I can replace the original script which is in the path and does not work with mine which works well.

      Best,
      --
      Gosseyn
Re: Help on how to compile/install module DBD::MariaDB/Mysql on Windows using Strawberry Perl
by pryrt (Abbot) on Jul 23, 2025 at 22:34 UTC

    You didn't say which version of Strawberry Perl you installed. But since you implied it was installed recently, I am going to assume 5.40.

    Your post Re^2: Help on how to compile/install module DBD::MariaDB/Mysql on Windows using Strawberry Perl was at 20:46 UTC, whereas there was a comment on the the SO post at 18:51 UTC, saying to look at syphilis's Re^3: MySQL/MariaDB DBD install problem here. Did you try that? Since you never commented in either location that you'd tried that, I am assuming not. So despite the fact that I don't have MariaDB server installed, I tried following those instructions.

    Specifically, I looked at syphilis's post, and used that as the basis for the following steps, which I ran, with the results as described:

    1. Download and install the MariaDB C Connectors at https://mariadb.com/downloads/connectors/ to get the header files in the right spot
      -- I don't know if that's a required step if you've already got MariaDB server installed
      -- For me, it installed some libraries into c:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib\ and some headers into c:\Program Files\MariaDB\MariaDB Connector C 64-bit\include\, so if the server didn't install anything into those directories, you might need to separately install the C Connectors.
    2. Since Strawberry Perl 5.40 doesn't come with the mysql_config.bat or some of the associated libraries, but syphilis pointed out in the other conversation that Strawberry Perl 5.38 does, I downloaded the zipfile for StrawberryPerl 5.38 Portable edition.
    3. Per syphilis's instructions, copy the 4 files from the specific directories in the 5.38 zipfile into your main StrawberryPerl 5.40 installation. That's easy to do by opening the zipfile in one Windows Explorer window, and your c:\strawberry\ (or wherever you installed 5.40) in a second Windows Explorer window -- obviously putting each file into the correct directory relative to that main directory, as per the instructions.
    4. At the command line, where your installed StrawberryPerl 5.40 is available, run cpanm DBD::MariaDB
      -- For me, it tried to install v1.24 of the module, but I got the same undefined reference to `__imp___pioinfo' as was mentioned for v1.23 in the other discussion.
      -- Thus, I tried to force the earlier v1.22 instead, using cpanm DBD::MariaDB@1.22 : this command was able to install DBD::MariaDB for me, in my Strawberry Perl 5.40. SUCCESS.

    Again, I don't know if having MariaDB server already installed will eliminate the first step or not. And you probably don't need to waste your time with the first cpanm DBD::MariaDB , and should probably go straight to cpanm DBD::MariaDB@1.22 . But this worked to get it installed for me (obviously, whether it will work with a server is something I cannot test). But if you haven't tried this sequence yet, you probably should.

Re: Help on how to compile/install module DBD::MariaDB/Mysql on Windows using Strawberry Perl
by ysth (Canon) on Jul 22, 2025 at 17:58 UTC
    Are you trying to do local development of something that is in production, in Perl? Or writing Perl as part of your job, or just using Perl as a tool to help you do your job? Does your job require you to work in windows or just have it installed on your work system? The more that you can tell us, the better we can suggest things to help.

    mysql 5.7 is not stable, it is well past end of life and no longer receiving security updates, so should be considered unsafe. You really should not use it unless you have to to mimic a production environment that is still using it.

    That said, show more exactly what you did to try to install DBD::mysql and what errors resulted. Maybe an older version would work?

    Not sure what role the database plays in your job; if you are using the MariaDB client, why not use the server too? Note that MySQL and MariaDB are not fully compatible anymore; each has added different features since the fork, or implemented new features in different, incompatible ways, though if you stick to things supported in MySQL 5.5, you won't see many issues.

    Other alternatives: run perl under WSL 2, or a VM, or cygwin? Any of those can make building modules easier.
      Sorry, perhaps it was not very explicit. Let me explain : I have more than one computer (including Macs, Raspberry PI...) but for historical reasons, I develop using Perl on a Windows PC. I mainly use MySQL and Perl to process databases requests, manipulating text files and converting data between two formats, for processing data between different softwares. For many years, I worked on this PC with MAMP and Active Perl, without any issue. MySQL 5.7 was very satisfying for my purpose. Everything was doing fine until I uninstalled Active Perl and installed Strawberry Perl, mainly because I had to reinstall some missing modules from CPAN.
      Due to the difficulties I had to install DBD::mysql modules, I tried MariaDB to check if it was working better, because more recent. I don't care to use MySQL or MariaDB. For me, this is the same. I don't need some particularities of the one or the second. And yes, I use a server in addition of the client. In fact, the mysql client or mariadb client is not very useful for me (but perhaps for the driver itself). I mainly use the server with my Perl scripts and with also a lot of PHPMyAdmin. But due to the emergency of this situation for me, I'm looking for other solutions that MySQL and MariaDB, which works pretty the same way, with Perl. But for years everything was very easy with the use of the mysql driver for DBI. I don't understand these sudden difficulties. I read here and elsewhere that I should downgrade the driver to an older version (v4x). Frankly, for my needs, I would be glad to use a binary distribution of the driver, like I had with Active Perl and PPM. It was working without any issue and was easy to install new modules.

      Unfortunately, I don't have much time to experiment different kind of installations, because I have already tried different things for the last 24 hours, including all yesterday's night. And now I need to go forward with my work, without spending extra time to try to "debug" the whole installation.

      I'll try to install Cygwin when I have so more time to play. Thanks for your help.
      Best.

      Sorry for the signature misplaced. I fixed it.
      Gosseyn
Re: Help on how to compile/install module DBD::MariaDB/Mysql on Windows using Strawberry Perl
by choroba (Cardinal) on Jul 22, 2025 at 18:36 UTC
    Crossposted to StackOverflow. It's considered polite to inform about crossposting so that people not attending both sites don't waste time hacking on a problem already solved at the other end of the internet.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Sorry, but the issue is not solved. I will inform you here if I can find a solution.
      Gosseyn