Dear Monks,

I'm trying to install DBD::mysql so that I can use perl's DBI.

  1. OSX 10.13.2
  2. Perl 5.20.2
  3. I installed MariaDB with homebrew because I got errors trying to install from source. MariaDB is located here: /usr/local/Cellar/mariadb/10.2.12/
  4. I use perlbrew, and to install modules I do: $ cpan DBD::mysql.
Here is the error I get when I try to install DBD::mysql:
... ... Test Summary Report ------------------- t/40server_prepare.t (Wstat: 256 Tests: 31 Failed: 1) Failed test: 27 Non-zero exit status: 1 t/40server_prepare_crash.t (Wstat: 11 Tests: 3 Failed: 0) Non-zero wait status: 11 Parse errors: Bad plan. You planned 39 tests but ran 3. t/40server_prepare_error.t (Wstat: 512 Tests: 3 Failed: 2) Failed tests: 1-2 Non-zero exit status: 2 Files=69, Tests=2041, 34 wallclock secs ( 0.52 usr 0.17 sys + 3.90 c +usr 0.77 csys = 5.36 CPU) Result: FAIL Failed 3/69 test programs. 3/2041 subtests failed. make: *** [test_dynamic] Error 255 MICHIELB/DBD-mysql-4.043.tar.gz /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, t +ry: reports MICHIELB/DBD-mysql-4.043.tar.gz $
Here is some info about my MariaDB install:
$ brew info mariadb mariadb: stable 10.2.12 (bottled), devel 10.3.4 Drop-in replacement for MySQL https://mariadb.org/ Conflicts with: mariadb-connector-c (because both install plugins) mysql (because mariadb, mysql, and percona install the same binaries +.) mysql-cluster (because mariadb, mysql, and percona install the same +binaries.) mysql-connector-c (because both install MySQL client libraries) mytop (because both install `mytop` binaries) percona-server (because mariadb, mysql, and percona install the same + binaries.) /usr/local/Cellar/mariadb/10.2.12 (640 files, 170MB) * Poured from bottle on 2018-01-27 at 00:05:02 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ma +riadb.rb ==> Dependencies Build: cmake ✘ Required: openssl ✔ ==> Options --with-archive-storage-engine Compile with the ARCHIVE storage engine enabled --with-bench Keep benchmark app when installing --with-blackhole-storage-engine Compile with the BLACKHOLE storage engine enabled --with-embedded Build the embedded server --with-libedit Compile with editline wrapper instead of readline --with-local-infile Build with local infile loading support --with-test Keep test when installing --devel Install development version 10.3.4 ==> Caveats A "/etc/my.cnf" from another install may interfere with a Homebrew-bui +lt server starting up correctly. MySQL is configured to only allow connections from localhost by defaul +t To connect: mysql -uroot To have launchd start mariadb now and restart at login: brew services start mariadb Or, if you don't want/need a background service you can just run: mysql.server start $
I searched around and it appears there is a DBD::MariaDB, but it isn't on cpan
DBD::MariaDB
I installed from source, but like I expected the DBI module can't find it:
use strict; use warnings; use 5.020; use autodie; use Data::Dumper; use DBI; my $dsn = 'dbi:mariadb:database=my_db;host=localhost'; my $dbh = DBI->connect($dsn, 'root', ''); --output:-- DBD::mariadb initialisation failed: Can't locate object method "driver +" via package "DBD::mariadb" at /Users/7stud/perl5/perlbrew/perls/per +l-5.20.2/lib/site_perl/5.20.2/darwin-2level/DBI.pm line 827.

In reply to DBD::mysql and MariaDB by 7stud

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.