Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Strawberry Perl & DBD::mysql

by prowler (Friar)
on Jan 22, 2009 at 06:10 UTC ( #738062=perlquestion: print w/ replies, xml ) Need Help??
prowler has asked for the wisdom of the Perl Monks concerning the following question:

I'm currently trying to get DBD::mysql installed for Strawberry Perl, and not having much success. It was originally having trouble finding a .h file, but I've managed to put that in a place it is happy with, but I haven't been able to get much further.

I'm actually trying to install DBIx::Class::Schema::Loader, which it is a prerequisite for, and would be perfectly happy with getting that to work with DBD::mysqlPP which was installed without hassle, but I haven't yet had any luck on that side either.

 - Spelling is a demanding task that requies you full attention.

Comment on Strawberry Perl & DBD::mysql
Replies are listed 'Best First'.
Re: Strawberry Perl & DBD::mysql
by diakopter (Novice) on Jan 23, 2009 at 22:08 UTC
    Yes, I've gotten it to work. Here are the steps I used:
    1. Download the file
    2. Make sure mysql.exe is in your path. Run it: perl
    3. It will generate a mysql_config.bat and file, and install them to your mysql/bin directory, hopefully. On mine, I had to edit the .bat slightly to get it to work with Strawberry - remove the "%~dp0" prefix from lines 4 and 7
    4. Run "cpan" from the Command Prompt.
    5. run the command "look DBD::mysql"
    6. edit the Makefile.PL with the edits shown at
    7. disable the server tests (if you want)
    8. perl Makefile.PL
    9. add path_to_mysql\lib\opt\libmysql.lib to the list of EXTRALIBS and LDLOADLIBS in Makefile Also, you need to make sure (it should already be) libmysql.dll is in your %PATH%. Note: since it was x64 windows mysql server bin\ that was in my %PATH%, I had to refer to the 32-bit libmysql.lib (stored in a different place), and also I had to put the 32-bit libmysql.dll in blib\arch\auto\DBD\mysql so that the tests run and it installed it correctly. That way (for me) it uses the 32-bit client .dll but operates against my 64-bit mysql server (which happens to be on localhost).
    10. dmake
    11. dmake test
    12. dmake install
    Thanks to Randy Kobe and Chris Nighswonger (see
      Thanks for the great tips! Turns out I didn't need to change the .bat file to remove %~dp0, but perhaps that is a Win32 vs Win64 issue. Again, massive thankyou.
      I badly need this patch and tried to run: has failed every time stating: 'C:\PROGRA~1\MySQL\MySQL' is not recognized as an internal or external command, operable program or batch file. Problem running C:\PROGRA~1\MySQL\MySQL Server 5.0\bin \mysqladmin.exe - aborting ... ...I went into the script and found that the variable: $mysqladmin was correctly getting the path in $mysqladmin @line 55, or thereabouts, of the script, however the next line: my $v = qx($mysqladmin version); results in no value in $v which then exits on the following "unless ($v) { etc, etc.... I attempted to run "mysqladmin version" at the command prompt which resulted in an error: "mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'ODBC'@'localhost' (using password: NO)' ...assuming this might be why $v gets no value, I spent hours trying to figure this out and did many things to my MySQL. I can get it to work issuing this command: mysqladmin -u root -p1588 version (1588 is just a dummy password value I put in...) ...first, I may be barking up the wrong tree here! ...second, if I am not, how do I feed the correct string to this portion of the script? Any help would be very much appreciated, it took me a long time to find this thread and answers to installing DBI and DBD:mysql on my Windows Vista machine with Perl 5.10 and the latest MySQL. I badly need wisdom and thank anyone who thinks they can explain this in advance! Best Pyrrhic
        'C:\PROGRA~1\MySQL\MySQL' is not recognized as an internal or external command

        I would think that the main problem here is that mysqladmin.exe is in a folder whose name contains white space (ie the "MySQL Server 5.0" part of the path).

        The best solution is to not put *anything* in such places - then you won't have to deal with the various workarounds. One such workaround in this instance (untested) is to replace $v = qx($mysqladmin version); with $v = qx("$mysqladmin" version);
        I think that will work - otherwise you could try  $v = qx("\"$mysqladmin\"" version);

Re: Strawberry Perl & DBD::mysql
by Anonymous Monk on Jan 22, 2009 at 08:02 UTC
Re: Strawberry Perl & DBD::mysql
by Anonymous Monk on Jun 13, 2009 at 23:58 UTC
    I just submitted a patch at rt://46926 that includes everything in the previously mentioned directions, plus a few things that were omitted. After extracting the distribution and applying it, run the Makefile.PL and everything should be copacetic.
Re: Strawberry Perl & DBD::mysql
by Anonymous Monk on Jan 22, 2009 at 13:50 UTC
    "I'm currently trying to get DBD::mysql installed for Strawberry Perl, and not having much success."

    All the more reason to use the right tool -- Linux.

    "Friends don't let friends use Windows."

      Sometimes using linux isn't a option...
Re: Strawberry Perl & DBD::mysql
by Anonymous Monk on Feb 24, 2009 at 22:46 UTC
    I am but a new monk, so forgive me if I speak nonsense.

    I was having the same issue and I solved it by using ppm, in what ended up being a delightfully simple end to a drawn-out battle.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://738062]
Approved by ikegami
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2015-10-09 04:02 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (233 votes), past polls