9 Replies Latest reply: Aug 7, 2012 9:58 AM by elimqiu
CB_49747 Level 1 Level 1 (0 points)

I'm trying to install DBD::mysql thru cpan on my macbook pro.

 

Here are my machine specs.

Model Name:    MacBook Pro

  Model Identifier:    MacBookPro8,2

  Processor Name:    Intel Core i7

  Processor Speed:    2.2 GHz

  Number of Processors:    1

  Total Number of Cores:    4

  L2 Cache (per Core):    256 KB

  L3 Cache:    6 MB

  Memory:    8 GB

  Boot ROM Version:    MBP81.0047.B0E

  SMC Version (system):    1.69f1

  Serial Number (system):    C0****1

  Hardware UUID:    CEC9E152-4A85-59FA-BA47-3DBCA32D9C89

  Sudden Motion Sensor:

  State:    Enabled

  System Version:    Mac OS X 10.6.7 (10J4138)

  Kernel Version:    Darwin 10.7.4

  Boot Volume:    Macintosh HD

  Boot Mode:    Normal

  Secure Virtual Memory:    Enabled

  64-bit Kernel and Extensions:    Yes

  Perl Version is 5.10.0

  mysql version is 5.5.12

 

I run the cpan command

sudo perl -MCPAN -e 'install DBD::mysql'

 

Below is what I get

 

bash-3.2# sudo perl -MCPAN -e 'install DBD::mysql'

 

bash-3.2# sudo perl -MCPAN -e 'install DBD::mysql'

CPAN: Storable loaded ok (v2.18)

Going to read '/Users/myuser/.cpan/Metadata'

  Database was generated on Wed, 22 Jun 2011 18:27:17 GMT

CPAN: YAML loaded ok (v0.72)

Going to read 142 yaml files from /Users/myuser/.cpan/build/

CPAN: Time::HiRes loaded ok (v1.9711)

DONE

Restored the state of none (in 1.4902 secs)

Running install for module 'DBD::mysql'

Running make for C/CA/CAPTTOFU/DBD-mysql-4.019.tar.gz

CPAN: Digest::SHA loaded ok (v5.61)

CPAN: Compress::Zlib loaded ok (v2.033)

Checksum for /Users/myuser/.cpan/sources/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.019.tar.gz ok

CPAN: Archive::Tar loaded ok (v1.76)

x DBD-mysql-4.019/

x DBD-mysql-4.019/MANIFEST

x DBD-mysql-4.019/ChangeLog

x DBD-mysql-4.019/TODO

x DBD-mysql-4.019/Makefile.PL

x DBD-mysql-4.019/myld

x DBD-mysql-4.019/eg/

x DBD-mysql-4.019/eg/proc_example2.pl

x DBD-mysql-4.019/eg/prepare_memory_usage.pl

x DBD-mysql-4.019/eg/proc_example3.pl

x DBD-mysql-4.019/eg/proc_example1.pl

x DBD-mysql-4.019/eg/proc_example2b.pl

x DBD-mysql-4.019/eg/bug21028.pl

x DBD-mysql-4.019/eg/bug14979.pl

x DBD-mysql-4.019/eg/issue21946.pl

x DBD-mysql-4.019/eg/bug30033.pl

x DBD-mysql-4.019/eg/decimal_test.pl

x DBD-mysql-4.019/eg/proc_example4.pl

x DBD-mysql-4.019/eg/proc_example2a.pl

x DBD-mysql-4.019/eg/bug30033pg.pl

x DBD-mysql-4.019/INSTALL.html

x DBD-mysql-4.019/META.yml

x DBD-mysql-4.019/mysql.xs

x DBD-mysql-4.019/dbdimp.h

x DBD-mysql-4.019/Makefile.PL.embedded

x DBD-mysql-4.019/MANIFEST.SKIP

x DBD-mysql-4.019/dbdimp.c

x DBD-mysql-4.019/constants.h

x DBD-mysql-4.019/lib/

x DBD-mysql-4.019/lib/DBD/

x DBD-mysql-4.019/lib/DBD/mysql.pm

x DBD-mysql-4.019/lib/DBD/mysql/

x DBD-mysql-4.019/lib/DBD/mysql/INSTALL.pod

x DBD-mysql-4.019/lib/DBD/mysql/GetInfo.pm

x DBD-mysql-4.019/lib/Bundle/

x DBD-mysql-4.019/lib/Bundle/DBD/

x DBD-mysql-4.019/lib/Bundle/DBD/mysql.pm

x DBD-mysql-4.019/t/

x DBD-mysql-4.019/t/41blobs_prepare.t

x DBD-mysql-4.019/t/71impdata.t

x DBD-mysql-4.019/t/42bindparam.t

x DBD-mysql-4.019/t/80procs.t

x DBD-mysql-4.019/t/51bind_type_guessing.t

x DBD-mysql-4.019/t/40server_prepare.t

x DBD-mysql-4.019/t/50commit.t

x DBD-mysql-4.019/t/76multi_statement.t

x DBD-mysql-4.019/t/30insertfetch.t

x DBD-mysql-4.019/t/70takeimp.t

x DBD-mysql-4.019/t/40nulls.t

x DBD-mysql-4.019/t/60leaks.t

x DBD-mysql-4.019/t/40listfields.t

x DBD-mysql-4.019/t/86_bug_36972.t

x DBD-mysql-4.019/t/29warnings.t

x DBD-mysql-4.019/t/41bindparam.t

x DBD-mysql-4.019/t/40server_prepare_error.t

x DBD-mysql-4.019/t/32insert_error.t

x DBD-mysql-4.019/t/40keyinfo.t

x DBD-mysql-4.019/t/75supported_sql.t

x DBD-mysql-4.019/t/35prepare.t

x DBD-mysql-4.019/t/35limit.t

x DBD-mysql-4.019/t/mysql.dbtest

x DBD-mysql-4.019/t/40types.t

x DBD-mysql-4.019/t/25lockunlock.t

x DBD-mysql-4.019/t/40nulls_prepare.t

x DBD-mysql-4.019/t/mysql.mtest

x DBD-mysql-4.019/t/55utf8.t

x DBD-mysql-4.019/t/85init_command.t

x DBD-mysql-4.019/t/00base.t

x DBD-mysql-4.019/t/40bindparam.t

x DBD-mysql-4.019/t/lib.pl

x DBD-mysql-4.019/t/52comment.t

x DBD-mysql-4.019/t/50chopblanks.t

x DBD-mysql-4.019/t/10connect.t

x DBD-mysql-4.019/t/53comment.t

x DBD-mysql-4.019/t/31insertid.t

x DBD-mysql-4.019/t/20createdrop.t

x DBD-mysql-4.019/t/65types.t

x DBD-mysql-4.019/t/40bindparam2.t

x DBD-mysql-4.019/t/mem_leak.pl

x DBD-mysql-4.019/t/40numrows.t

x DBD-mysql-4.019/t/40catalog.t

x DBD-mysql-4.019/t/40blobs.t

x DBD-mysql-4.019/README

CPAN: File::Temp loaded ok (v0.22)

CPAN: Parse::CPAN::Meta loaded ok (v1.4401)

CPAN: CPAN::Meta loaded ok (v2.110580)

CPAN: Module::CoreList loaded ok (v2.46)

 

  CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-4.019.tar.gz

 

 

 

PLEASE NOTE:

 

For 'make test' to run properly, you must ensure that the

database user 'root' can connect to your MySQL server

and has the proper privileges that these tests require such

as 'drop table', 'create table', 'drop procedure', 'create procedure'

as well as others.

 

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';

 

You can also optionally set the user to run 'make test' with:

 

perl Makefile.PL --testuser=username

 

I will use the following settings for compiling and testing:

 

  cflags        (mysql_config) = -I/usr/local/mysql/include  -Os -g -fno-common -fno-strict-aliasing -arch x86_64

  embedded      (mysql_config) =

  libs          (mysql_config) = -L/usr/local/mysql/lib -lmysqlclient   -lpthread

  mysql_config  (guessed     ) = mysql_config

  nocatchstderr (default     ) = 0

  nofoundrows   (default     ) = 0

  ssl           (guessed     ) = 0

  testdb        (default     ) = test

  testhost      (default     ) =

  testpassword  (default     ) =

  testsocket    (default     ) =

  testuser      (guessed     ) = root

 

To change these settings, see 'perl Makefile.PL --help' and

'perldoc INSTALL'.

 

Checking if your kit is complete...

Looks good

Multiple copies of Driver.xst found in: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/ /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/auto/DBI/ at Makefile.PL line 914

Using DBI 1.616 (for perl 5.010000 on darwin-thread-multi-2level) installed in /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/

Writing Makefile for DBD::mysql

Could not read metadata file. Falling back to other methods to determine prerequisites

cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm

cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm

cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod

cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm

gcc-4.2 -c  -I/Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI -I/usr/local/mysql/include  -Os -g -fno-common -fno-strict-aliasing -arch x86_64 -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -Os   -DVERSION=\"4.019\" -DXS_VERSION=\"4.019\"  "-I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE"   dbdimp.c

dbdimp.c: In function ‘alloc_param’:

dbdimp.c:223: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_bind’:

dbdimp.c:241: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_fbind’:

dbdimp.c:257: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_fbuffer’:

dbdimp.c:272: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘parse_params’:

dbdimp.c:589: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘my_login’:

dbdimp.c:1996: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘mysql_describe’:

dbdimp.c:3605: warning: assignment from incompatible pointer type

dbdimp.c:3606: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘mysql_st_fetch’:

dbdimp.c:3798: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_param’:

dbdimp.c:223: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_bind’:

dbdimp.c:241: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_fbind’:

dbdimp.c:257: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_fbuffer’:

dbdimp.c:272: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘parse_params’:

dbdimp.c:589: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘my_login’:

dbdimp.c:1996: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘mysql_describe’:

dbdimp.c:3605: warning: assignment from incompatible pointer type

dbdimp.c:3606: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘mysql_st_fetch’:

dbdimp.c:3798: warning: format not a string literal and no format arguments

/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed

Installed assemblers are:

/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64

/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386

dbdimp.c: In function ‘alloc_param’:

dbdimp.c:223: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_bind’:

dbdimp.c:241: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_fbind’:

dbdimp.c:257: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘alloc_fbuffer’:

dbdimp.c:272: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘parse_params’:

dbdimp.c:589: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘my_login’:

dbdimp.c:1996: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘mysql_describe’:

dbdimp.c:3605: warning: assignment from incompatible pointer type

dbdimp.c:3606: warning: format not a string literal and no format arguments

dbdimp.c: In function ‘mysql_st_fetch’:

dbdimp.c:3798: warning: format not a string literal and no format arguments

lipo: can't open input file: /var/tmp//cc58vlsv.out (No such file or directory)

make: *** [dbdimp.o] Error 2

  CAPTTOFU/DBD-mysql-4.019.tar.gz

  make -- NOT OK

Running make test

  Can't test without successful make

Running make install

  Make had returned bad status, install seems impossible

bash-3.2#

 

I also know that root can access the database and there is a table test.  Any help would be greatly appreciated.

 

<Edited by Host>


MacBook Pro, Mac OS X (10.6.7)
  • 1. Re: DBD::mysql
    CB_49747 Level 1 Level 1 (0 points)

    Anyone have any ideas?

  • 2. Re: DBD::mysql
    orpheus2006 Level 1 Level 1 (10 points)

    I have exactly the same problem with my

    iMac Core i5

    Mac OS X 10.6.7

    Perl 5.10.0

    mysql  5.5.13 (64 bit)

     

    I'm currently searching the web for further hints ...

  • 3. Re: DBD::mysql
    CB_49747 Level 1 Level 1 (0 points)

    I did a lot of searching and was unable to find anything that helped.  Let me know if you find anything though.

  • 4. Re: DBD::mysql
    orpheus2006 Level 1 Level 1 (10 points)

    Got it!

    The solution is quite easy. After creating the Makefile using perl Makefile.PL, edit the Makefile and remove all occurrences of

    -arch ppc

     

    Then continue with

    make

    make test

    sudo make install

     

    Good luck!

  • 5. Re: DBD::mysql
    orpheus2006 Level 1 Level 1 (10 points)

    Now, here is the long description:

     

    MySQL and DBD::MySQLinstallation on Mac OS X Snow Leopard (64-bit)

    Go for 64-bit! This is the right way to go when you have Snow Leopard.

     

    Step 1: Install MySQL 64-bit version

    Download the MySQL Community Server from http://dev.mysql.com/downloads/mysql/#downloads

    Latest stable MySQL version is 5.5.13. I recommend to use the DMG package (mysql-5.5.13-osx10.6-x86_64.dmg).

    It will install to /usr/local directory by default. Also install the startup items and prefPane programs that come with the package. You can then activate/deactivate the MySQL server using the System Preferences application.

     

    Step 2: Configure MySQL

    Assign a password for database user 'root'. Open the Unix shell and enter:

    > PATH=$PATH:/usr/local/mysql/bin

    > mysqladmin -u root password NEW_ROOT_PASSWORD

    You can then create new users, databases and tables either using the mysql command or using browser-based tools such as phpMyAdmin or SQLbuddy. 

     

    Step 3: Install DBD::MySQL

    Open the Unix shell and enter the following commands:

    First you may want to check your perl version:

    > perl -v

    You should have perl version 5.10.0.

     

    Then get the DBD module from CPAN:

    > perl -MCPAN -e 'shell'

    cpan[1]> get DBD::mysql

    cpan[2]> exit

    > cd ~/.cpan/build/DBD-mysql-5*/

    > perl Makefile.PL--testuser='mysql_user_name' --testpassword='mysql_passwd'

    Note: use mysql_user_name and mysql_paasword of a user that you created in step 2

     

    > make

    Unfortunately, this is where things are not as straight-forward and you may encounter one of the following problems:

    (1) if you see a "make: command not found" error then make is not installed on your Mac and you need to install the Xcode developer tools. It's on one of the DVDs that shipped with your Mac.

    (2) if make fails with an "make: *** [dbdimp.o] Error 2" error, you need to edit the Makefile. Remove all occurrences of '-arch ppc', save the Makefile and then call make again.

    (3) if make fails with an "Library not loaded: libmysqlclient" error, you can solve the problem by placing a symbolic link as follows:

         > cd /usr/local/lib

         > sudo ln -s/usr/local/mysql/lib/*.dylib .

         > make

     

    If make runs successfully, continue with:

    > make test

    It should say all test successful.

     

    Finally install the DBD::MySQL package for which you need your Mac OS X root password (don't confuse it with the MySQL root password!):

    > sudo make install

    Installation is done!

     

    Step 4: you can now test your Perl DBI scripts

  • 6. Re: DBD::mysql
    CB_49747 Level 1 Level 1 (0 points)

    Orpheus,

     

    Thank you so much.  Did the above and it worked.  Thanks again.

     

    Below are a couple minor changes I made to instructions above to get mine to work.

     

     

    First:

    DBD::mysql from cpan was version 4.xxxxx so I had to change the dir after exiting cpan with the below command.

     

    cd ~/.cpan/build/DBD-mysql-4*/

     

    not the cd ~/.cpan/build/DBD-mysql-5*/ listed above.

     

    Second:

    After removing all mentions of -arch ppc from the make file I was able to run the make with out errors, however when I ran make test I got the "Library not loaded:  libmysqlclient" error.  So I did the ln command, but I had to alter it a bit to get it to work.  Below is what I used.

     

    sudo ln -s /usr/local/mysql-5.5.12-osx10.6-x86_64/lib/*.dylib .

     

    One other thing that I wanted to mention is that the . at the end is very important.  I did not know that and caused me some problems.

     

    So two minor changes that may help someone else.

     

    Again thanks orpheus this was a life savor for me.

  • 7. Re: DBD::mysql
    orpheus2006 Level 1 Level 1 (10 points)

    Glad it worked for you!

     

    BTW I admit I made a typo. Indeed it must read

    cd ~/.cpan/build/DBD-mysql-4*/

     

    There is no DBD::mysql version 5. The latest version is 4.019.

  • 8. Re: DBD::mysql
    Christopher Menzel1 Level 1 Level 1 (0 points)

    This great post from orpheus2006 solved our problems as well, a year later. Mountain Lion broke our MySQL installation badly. We upgraded to the latest version, which was a bit of a nightmare in itself, but even after geting that straightened out we could not get mysql.pm to install successfully. Posts from Leopard/Snow Leopard days suggested we needed to be running the 32-bit version of MySQL which, aside from the awful prospect of having to undo everything we'd done to get the latest 64-bit version running, just sounded nuts. Our problem was the "Library not loaded: libmysqlclient" error and orpheus2006's solution nailed it. Many thanks for your help!

     

    Small omission in the instructions in step (3) — you of course need to cd back to the relevant .cpan/build/DBD-mysql-4.* dir before issuing the "make" command. And small typo: the package is DBD::mysql not DBD::MySQL.

  • 9. Re: DBD::mysql
    elimqiu Level 1 Level 1 (0 points)

    My version of DBD:mysql trouble:

     

    First of all, I used cpan download the DBD:mysql, and did make, make test and make install. cpan says my DBD:mysql is up to the date but my perl script keep telling me DBD:mysql is not installed.

     

    Second of all, during any make, I saw lots "format not a string literal and no format arguments" warnings that really make me think the build/installation is broken even it says successful

     

    Third of all, If I relocate mysql data directory (specify datadir in  /etc/my.cnf), make test will go wrong

    <====

                                 .....ok

    t/71impdata.................ok                                              

    t/75supported_sql...........ok                                              

    t/76multi_statement.........ok 1/25# Testing multicall against SQL_DBMS_VER: 5.5.27

    t/76multi_statement.........ok                                              

    t/80procs...................ok 1/29DBD::mysql::db do failed: Cannot load from mysql.proc. The table is probably corrupted at t/80procs.t line 41.

    DBD::mysql::db do failed: Cannot load from mysql.proc. The table is probably corrupted at t/80procs.t line 41.

    # Looks like you planned 29 tests but ran 2.

    # Looks like your test exited with 255 just after 2.

    t/80procs...................dubious                                         

              Test returned status 255 (wstat 65280, 0xff00)

    DIED. FAILED tests 3-29

              Failed 27/29 tests, 6.90% okay

    t/85init_command............ok                                              

    t/86_bug_36972..............ok                                              

    Failed Test Stat Wstat Total Fail  List of Failed

    =====>

     

     

    But if I restart mysql with default datadir location, make test will go through ok:

    <=====

    t/52comment.................ok                                              

    t/53comment.................ok                                              

    t/55utf8....................ok                                              

    t/60leaks...................skipped

            all skipped: Skip $ENV{SLOW_TESTS} is not set

    t/65types...................ok                                              

    t/70takeimp.................ok                                              

    t/71impdata.................ok                                              

    t/75supported_sql...........ok                                              

    t/76multi_statement.........ok 1/25# Testing multicall against SQL_DBMS_VER: 5.5.27

    t/76multi_statement.........ok                                              

    t/80procs...................ok                                              

    t/85init_command............ok                                              

    t/86_bug_36972..............ok                                              

    All tests successful, 1 test skipped.

    Files=40, Tests=890, 16 wallclock secs ( 7.95 cusr +  1.41 csys =  9.36 CPU)

    ========>

     

    After all, what cpan says DBD:mysql is ok but real perl scripts say it not OK?

     

     

    BTW, I'm still using snow leopard with its built-in perl 5.10.0, plus mysql 5.5.27, all of 64bit