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

Hello Monks, I'm trying to setup DBI and DBD::mysql on my new Apple silicon mac, and I'm getting all kinds of errors installing the module. Has anyone had success with this, and have any tips or a guide?

Replies are listed 'Best First'.
Re: DBD::mysql on MacOS Ventura (AArch64)
by afoken (Chancellor) on Apr 04, 2023 at 09:48 UTC
    I'm getting all kinds of errors installing the module

    Then why don't you post the error messages?

    Just a guess: you may need to install the MySQL client libraries.

    If you can't get DBD::mysql running, try DBD::MariaDB. It should be fully compatible, and is said to have less bugs and legacy problems.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Found the issue. There was a bug that the latest version of ExtUtils::MakeMaker fixed. Solution was to install the latest version of ExtUtils::MakeMaker rather than the default that came with Ventura. Bug is documented here: https://github.com/perl5-dbi/DBD-mysql/issues/337
      There were lots of warnings that threw me off, but I suspect they can all be ignored. I think this here is the key error:
      # Failed test 'use DBD::mysql;' # at t/00base.t line 15. # Tried to use 'DBD::mysql'. # Error: Can't load '/private/var/root/.cpan/build/DBD-mysql-4.05 +0-8/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlo +pen(/private/var/root/.cpan/build/DBD-mysql-4.050-8/blib/arch/auto/DB +D/mysql/mysql.bundle, 0x0002): Library not loaded: @rpath/libmysqlcli +ent.21.dylib # Referenced from: <7D546A82-F230-3186-ADBB-6393EF2F59D5> /private/v +ar/root/.cpan/build/DBD-mysql-4.050-8/blib/arch/auto/DBD/mysql/mysql. +bundle # Reason: tried: '/System/Volumes/Preboot/Cryptexes/OS@rpath/libmysq +lclient.21.dylib' (no such file), '/usr/lib/libmysqlclient.21.dylib' +(no such file, not in dyld cache), (security policy does not allow @ +path expansion) at /System/Library/Perl/5.30/darwin-thread-multi-2lev +el/DynaLoader.pm line 197. # at t/00base.t line 15.
      So it does appear to be library related. On Ventura, /usr/lib is read-only. It's not looking for the dylib at /usr/local/mysql/lib, even though that is the path in mysql_config.
      I will use the following settings for compiling and testing: cflags (mysql_config) = -I/usr/local/mysql/include embedded (guessed ) = ldflags (guessed ) = libs (mysql_config) = -L/usr/local/mysql/lib -lmysqlclient +-lssl -lcrypto -lresolv mysql_config (guessed ) = mysql_config nocatchstderr (default ) = 0 nofoundrows (default ) = 0 nossl (default ) = 0 testdb (default ) = test testhost (default ) = testpassword (default ) = testport (default ) = testsocket (default ) = testuser (guessed ) = len
Re: DBD::mysql on MacOS Ventura (AArch64)
by hippo (Archbishop) on Apr 04, 2023 at 10:50 UTC
Re: DBD::mysql on MacOS Ventura (AArch64)
by karlgoethebier (Abbot) on Apr 05, 2023 at 11:01 UTC

    Did you read: «… You need not install the actual MySQL database server, the client files and the development files are sufficient. For example, Fedora Linux distribution comes with RPM files (using YUM) mysql and mysql-server (use "yum search" to find exact package names). These are sufficient, if the MySQL server is located on a foreign machine. You may also create client files by compiling from the MySQL source distribution and using configure --without-server…»

    «The Crux of the Biscuit is the Apostrophe»