Larry Menard
Larry Menard

Reputation: 17

Can't locate DBD/mysql.pm after upgrading Strawberry Perl on Windows

I recently updated the Strawberry Perl on a Windows system from 5.32 to 5.40, and now I can't connect to my MariaDB database using DBI.

Here is the script:

#!/usr/bin/perl

use strict;
use warnings;

use DBI;

my $dsn = "DBI:mysql:database=mydb;host=localhost";
my $username = "root";
my $password = "MariaDBRootPassword";

my $dbh = DBI->connect(
    "$dsn",
    "$username",
    "$password",
    {
        PrintError => 0,
        RaiseError => 1
    }
);

$dbh->disconnect();

Every article I can find tells me that should still work. (And it does still work on my Linux systems.)

The error I get is:

install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC entries checked: C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib) at (eval 6) line 3. Perhaps the DBD::mysql perl module hasn't been fully installed, or perhaps the capitalisation of 'mysql' isn't right. Available drivers: ADO, CSV, DBM, ExampleP, File, Gofer, Mem, ODBC, Pg, Proxy, SQLite, Sponge. at temp.pl line 12.

Sure enough, there is no "DBD/mysql.pm" in those @INC directories. Various articles say that the "DBD::mysql" module is supposed to be included by default in Strawberry Perl.

I don't recall having to do anything to my previous Strawberry Perl installation to make it work.

Any help would be appreciated.

Update: As I suspected, the same happens when I try to connect to a MySQL database (as opposed to MariaDB).

Upvotes: 0

Views: 138

Answers (0)

Related Questions