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

The Sqitch project got a request to switch from DBD::mysql to DBD::MariaDB. DBD::mysql 5's requirement to build from the MySQL 8 client library provides the impetus for the request, but in poking around, I found a blogs.perl.org post highlighting some Unicode fixes in DBD::MariaDB, as well.

Now, Sqitch likely doesn't have the Unicode issue (it always works with Perl Unicode strings), but it depends on URI::db to provide the DBI connection string. For MySQL URIs, the URI::mysql dbi_driver method returns mysql.

Should it be changed to return MariaDB, instead? Is there general community consensus that DBD::MariaDB provides better compatibility with both MySQL and MariaDB these days?

I'm also curious what the impact of this change would be for Sqitch. Presumably, if DBD::MariaDB can build against either the MariaDB or MySQL client library, it is the more flexible choice to continue supporting both databases going forward.

Update: I've created a URI::db pull request for further discussion.

  • Comment on Should URI::mysql Switch to DBD::MariaDB?

Replies are listed 'Best First'.
Re: Should URI::mysql Switch to DBD::MariaDB?
by 1nickt (Canon) on Jan 02, 2025 at 11:19 UTC

    Hi, at $work we are using MySQL 8 and DBD::mysql 5 but it was a forced update to the DB server because we wanted to stay up to date with the Perl lib. For a while on my own development box I used DBD::MariaDB and it is certainly a working drop-in replacement. If your project does not wish to compel users to update their DB server I would say switching to MariaDB would be the right choice, but I don't know that URI::mysql should change. If anything a URI::MariaDB package should be available, and let downstream authors (like you) choose. (I note that there is URI::mariadb but it's incomplete.)


    The way forward always starts with a minimal test.
      Yes, perhaps it makes sense to modify URI::db with:
      --- a/lib/URI/maria.pm +++ b/lib/URI/maria.pm @@ -1,5 +1,5 @@ package URI::maria; -use base 'URI::mysql'; +use base 'URI::mariadb'; our $VERSION = '0.23'; 1; diff --git a/lib/URI/mariadb.pm b/lib/URI/mariadb.pm index 7072283..889abbf 100644 --- a/lib/URI/mariadb.pm +++ b/lib/URI/mariadb.pm @@ -2,4 +2,6 @@ package URI::mariadb; use base 'URI::mysql'; our $VERSION = '0.23'; +sub dbi_driver { 'MariaDB' } + 1;
Re: Should URI::mysql Switch to DBD::MariaDB?
by Theory (Beadle) on Jan 09, 2025 at 02:59 UTC

    Update: > The URI-db 0.23 dbi_dsn() method now uses URI::MariaDB for both URI::mysql and URI::MariaDB.

Re: Should URI::mysql Switch to DBD::MariaDB?
by InfiniteSilence (Curate) on Jan 03, 2025 at 06:30 UTC

    Looks like the Oracle folks are having a bit of a time keeping up with the devs that jumped ship.

    "...main image supports Postgres, SQLite, and MySQL..."

    Looks like only one of those is being maintained by a big corporation.

    "...Perhaps we need to add a MariaDB variant with a separate Docker tag..."

    Or maybe the other way around...make MariaDB the new core option and force people to use a special image for MySql?

    Celebrate Intellectual Diversity

      “Looks like only one of those is being maintained by a big corporation.”

      I suppose the functionality would be pretty much the same by depending on MariaDB stuff. One could still connect to MySQL. For the Homebrew formula, though, I don't see a client-only Homebrew formula for MariaDB, alas. I see only the full package and a c connector, but maybe that includes the client library and CLI?

      “Or maybe the other way around...make MariaDB the new core option and force people to use a special image for MySql?”

      I'd be wary of breaking things unexpectedly for users.

Re: Should URI::mysql Switch to DBD::MariaDB?
by Theory (Beadle) on Jan 04, 2025 at 00:02 UTC

    Not sure whether to change URI::db or not, but the Sqitch update is pretty painless.

Re: Should URI::mysql Switch to DBD::MariaDB?
by Anonymous Monk on Jan 09, 2025 at 08:36 UTC
    Please see https://blogs.perl.org/users/grinnz/2023/12/migrating-from-dbdmysql-to-dbdmariadb.html - while I think that it is a good idea for everyone to make the switch to DBD::MariaDB to avoid subtle and less-subtle issues, the switch can cause its own subtle bugs to code that was previously relying on DBD::mysql's broken unicode behavior. I'm not sure how it applies to Sqitch, but changing it for all db:mysql urls in arbitrary projects could introduce breaking changes.