How to get perl to connect to mysql using DBD:mysql
November 23, 2012 12:00 PM   Subscribe

I'm over my head again trying to run a program for a class and you were a great help last time. I'm trying to connect to mysql from Perl and have installed DBD:mysql on my Mac (OS X 10.5.8). I have no idea what I'm doing. Can you help?

I get the following error whenever I try to run my perl test script:

dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup

dyld: Symbol not found: _mysql_init
Referenced from: /Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup

Trace/BPT trap

All instructions posted for the class are for Windows and I am lost. I googled this error but all the answers I found are over-my-head computer speak. I rarely do more than the most basic commands in the terminal, so I have no idea where to even begin to know what might be wrong. Can you help me? Let me know what other information I can provide.
posted by sunshine37 to Computers & Internet (6 answers total)
 
I would just install XAMPP for OS X, install the developer bundle too, and then install DBD::mysql in it. It's quite possible to get the same error if you mix up which version of Perl you're using, but here's how to be consistent and build against XAMPP's copies of Perl and MySQL only.

There's probably a shorter path to solving the actual problem you have, but that's a fairly simple recipe that doesn't require further knowledge of your machine and what you've done so far.
posted by Monsieur Caution at 12:19 PM on November 23, 2012 [2 favorites]


Doesn't sound like you have DBD::Mysql installed properly or is installed in the wrong location. Any reason why you can't just use Windows in a VM?
posted by wongcorgi at 12:23 PM on November 23, 2012


I would also suggest Virtualbox as a free VM solution. You can get pre-made LAMP images where everything will just work.

However, 10.5.8 is pretty old. And I can't find if Virtualbox will run on it as a host OS.
posted by sbutler at 12:34 PM on November 23, 2012


If you've only installed DBD:MySql, you might also have to install DBI
posted by rhizome at 1:10 PM on November 23, 2012


Does your Mac have a 64 bit processor?
posted by Obscure Reference at 1:42 PM on November 23, 2012


Perl 5.8.8 is ancient, and so far out of support that it is has become a beast to work with. Throw in the possibility that your MySQL is more recent than your DBD::mysql can support and the possibility that you have a 32bit vs 64bit library mismatch in there and you're set for a world of hurt. Never use the old system Perl unless you have to, Apple and RedHat are notorious for mucking up the system Perl to the point that the answer to all problems that start "I'm using /usr/bin/perl" is "Don't, system Perl is fucked up. Build and use your own Perl."
I'd definitely go Monsieur Caution's route of using XAMPP and getting yourself a consistent environment with more recent versions of applications built to work with each other. (But I find it odd that XAMPP's Perl wouldn't already have DBI,DBD::mysql included.)

And if you go instead the VM route, for goodness sake don't install Windows. Install Ubuntu or Debian. There's no sane reason to install *Windows* to do *MySQL* and *Perl*. That's just madness plain and simple.
posted by zengargoyle at 4:57 PM on November 23, 2012


« Older What should I look for in a te...   |  Sewing-filter: Top 5 tips for ... Newer »
This thread is closed to new comments.