Ron Savage wrote:



Set DBI_DSN=dbi:mysql:test
and DBI_USER='xxx'
and DBI_PASS='yyy'
and export them if you're using that kind on shell.
Rerun make test and let us know.



I took your suggestion, but it still took many hours last night and today to get DBD::mysql installed. Here's how I ultimately did it.

But first, a tangent. Since my OP was not immediately posted to the list, I had several hours to think of possible explanations of the problem. I decided that, as a backup strategy for learning MySQL, I would install MySQL on my iBook. So I went to http://dev.mysql.com/downloads/mysql/5.0.html and downloaded a binary of MySQL v5.0 for Mac OS X 10.3. It installed like butter. I had previously installed DBI and upgraded it to v1.50. So I then decided to try to get DBD::mysql installed on the iBook. Again, it went in like butter.

Given that, I began to wonder whether the problem lay in the fact that I was using an older version of MySQL on my Linux server: v4.1, the default version for Debian stable. I decided to explore that hypothesis. So this morning I removed the Debian MySQL and DBI packages from my server (or, to be precise, as many of the packages as 'apt-get remove' could locate; some it claimed it could not locate). I then downloaded and installed a non-RPM binary of MySQL 5.0 for Linux from a MySQL mirror.

At that point, of course, I had to spend an hour configuring my new MySQL server installation. For the record, I consulted the following pages in the MySQL docs:

http://dev.mysql.com/doc/refman/5.0/en/linux-rpm.html
   # 2.4 Installing MySQL on Linux

http://dev.mysql.com/doc/refman/5.0/en/unix-post-installation.html
   # 2.9.2. Unix Post-Installation Procedures

http://dev.mysql.com/doc/refman/5.0/en/option-files.html
   # 4.3.2. Using Option Files

http://dev.mysql.com/doc/refman/5.0/en/access-denied.html
   # 5.8.8. Causes of Access denied Errors

http://dev.mysql.com/doc/refman/5.0/en/can-not-connect-to-server.html
   # A.2.2. Can't connect to [local] MySQL server

http://dev.mysql.com/doc/refman/5.0/en/problems-with-mysql-sock.html
   # A.4.5. How to Protect or Change the MySQL Unix Socket File

In the configuration process, I deleted the anonymous user accounts, created MySQL accounts for 'root' and myself, and -- most importantly -- created .my.cnf files for both root and myself. I don't think the DBD::mysql installation would ultimately have succeeded without them.

So, nearly a day later, I was ready to return to ~/.cpan/build/DBD-mysql-3.0002 and try anew. I tried 'perl Makefile.PL' and 'make', then held my breath and called 'make test'.

And the test failed again.  But with a new error:

> PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/00base.............ok
> t/10dsnlist..........DBI connect('test','',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at t/10dsnlist.t line 45 > Cannot connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
>         Either your server is not up and running or you have no
>         permissions for acessing the DSN DBI:mysql:test.
>         This test requires a running server and write permissions.
>         Please make sure your server is running and you have
>         permissions, then retry.
> t/10dsnlist..........dubious
>         Test returned status 10 (wstat 2560, 0xa00)
> DIED. FAILED tests 1-9

I had seen a posting about the "Can't connect ... through socket" error on Google somewhere. From the doc pages cited above, I learned that I could call:

    # netstat -ln | grep mysql

to determine the location of the mysql.sock file. In the distribution I got from MySQL, it turns out that the socket is found at /tmp/mysql.sock, not at /var/run/mysqld/mysqld.sock . In a moment of inspiration, I decided to create a /var/run/mysqld directory and create a link therein to /tmp/mysql.sock.

    # cd /var/run
    # mkdir mysqld
    # cd mysqld
    # ln -s  /tmp/mysql.sock mysqld.sock

I then returned the .cpan/build/DBD-mysql-3.0002 directory and tried 'make test' again. Still no luck, but it was at this point that I began to try to implement your suggestions.

    # DBI_USER=root
    # DBI_PASS=secret
    # DBI_DSN=dbi:mysql:test

Tried 'make test' again. Again, it failed. To cut to the chase, I consulted the DBD::mysql documentation (http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql/INSTALL.pod#Configuration) and realized that what I had to do was to provide $DBI_USER and $DBI_PASS as command-line arguments to 'perl Makefile.PL'. Then, and only then, did I get the desired results:

    # perl Makefile.PL --testuser=$DBI_USER \
    >                  --testpassword=$DBI_PASS
    I will use the following settings for compiling and testing:

      cflags        (mysql_config ) = -I/usr/include/mysql -DBIG_JOINS=1
      embedded      (mysql_config ) =
libs (mysql_config ) = -L/usr/lib -lmysqlclient -lz -lcrypt -lnsl -lm
      mysql_config  (guessed      ) = mysql_config
      nocatchstderr (default      ) = 0
      nofoundrows   (default      ) = 0
      ssl           (guessed      ) = 0
      testdb        (default      ) = test
      testhost      (default      ) =
      testpassword  (User's choice) = secret
      testsocket    (default      ) =
      testuser      (User's choice) = root

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

Using DBI 1.50 (for perl 5.008007 on i686-linux) installed in /usr/local/lib/perl5/site_perl/5.8.7/i686-linux/auto/DBI/
    Writing Makefile for DBD::mysql

I then called 'make' and, holding my breath even tighter, 'make test'. At last:

    # make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
    t/00base.............ok
    t/10dsnlist..........ok
    t/20createdrop.......ok
    t/30insertfetch......ok
    t/35limit............ok
    t/40bindparam........ok
    t/40blobs............ok
    t/40listfields.......ok
    t/40nulls............ok
    t/40numrows..........ok
    t/41blobs_prepare....ok
    t/50chopblanks.......ok
    t/50commit...........ok
    t/60leaks............skipped
all skipped: $ENV{SLOW_TESTS} is not set or Proc::ProcessTable not installed
    t/ak-dbd.............ok
    t/akmisc.............ok
    t/dbdadmin...........ok
    t/insertid...........ok
    t/mysql..............ok
    t/mysql2.............ok
    All tests successful, 1 test skipped.
Files=20, Tests=903, 29 wallclock secs ( 3.57 cusr + 1.68 csys = 5.25 CPU)

(Huge exhale.) This was the most difficult Perl module installation I've ever faced. Thanks for your assistance.

jimk

Reply via email to