DBD::mysql failing to "make test"

DBD::mysql failing to "make test"

am 20.02.2006 04:08:52 von jkeen_via_google

Hello all. I am getting my feet wet with MySQL and DBI. I am running
Linux 2.4.29, Debian 3.1, Perl 5.8.7, MySQL 4.1.11, and DBI version
1.50. To teach myself, I have been (re-)working my way through Paul
DuBois' 'MySQL' book, first edition. I've had no problem connecting to
the server with the 'mysql' client and running the test exercises. So
now I'm up to the chapter on the Perl DBI.

The DBI *per se* I should have no problem with, because I've installed
it in the past for SQLite. But today I have had a difficult time
getting DBD::mysql to install. I first tried through the 'cpan' shell
and failed at 'make test'. I had to stop for a couple of hours; when I
came back to my desk I decided to try to install it manually. I went to
the directory where everything had been unwrapped earlier:
~/.cpan/build/DBD-mysql-3.0002. I got through 'perl Makefile.PL' and
'make' more or less unscathed.

[DBD-mysql-3.0002] 690 $ sudo perl Makefile.PL
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 (default ) =
testsocket (default ) =
testuser (default ) =

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

Checking if your kit is complete...
Looks good
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

[DBD-mysql-3.0002] 691 $ sudo make
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/Mysql.pm blib/lib/Mysql.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Mysql/Statement.pm blib/lib/Mysql/Statement.pm
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
cc -c -I/usr/local/lib/perl5/site_perl/5.8.7/i686-linux/auto/DBI/
-I/usr/include/mysql -DBIG_JOINS=1 -DDBD_MYSQL_INSERT_ID_IS_GOOD -g
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"3.0002\"
-DXS_VERSION=\"3.0002\" -fpic
"-I/usr/local/lib/perl5/5.8.7/i686-linux/CORE" dbdimp.c
/usr/local/bin/perl -p -e "s/~DRIVER~/mysql/g"
/usr/local/lib/perl5/site_perl/5.8.7/i686-linux/auto/DBI//Dr iver.xst >
mysql.xsi
/usr/local/bin/perl /usr/local/lib/perl5/5.8.7/ExtUtils/xsubpp -typemap
/usr/local/lib/perl5/5.8.7/ExtUtils/typemap mysql.xs > mysql.xsc && mv
mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line 224
Warning: duplicate function definition 'rows' detected in mysql.xs, line 559
cc -c -I/usr/local/lib/perl5/site_perl/5.8.7/i686-linux/auto/DBI/
-I/usr/include/mysql -DBIG_JOINS=1 -DDBD_MYSQL_INSERT_ID_IS_GOOD -g
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"3.0002\"
-DXS_VERSION=\"3.0002\" -fpic
"-I/usr/local/lib/perl5/5.8.7/i686-linux/CORE" mysql.c
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.so
LD_RUN_PATH="/usr/lib" /usr/local/bin/perl myld cc -shared
-L/usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.so
-L/usr/lib -lmysqlclient -lz -lcrypt -lnsl -lm
chmod 755 blib/arch/auto/DBD/mysql/mysql.so
cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs
chmod 644 blib/arch/auto/DBD/mysql/mysql.bs
Manifying blib/man3/DBD::mysql.3
Manifying blib/man3/DBD::mysql::INSTALL.3
Manifying blib/man3/Mysql.3
Manifying blib/man3/Bundle::DBD::mysql.3

But then, when I got to 'make test', all hell broke loose.

[DBD-mysql-3.0002] 692 $ 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..........DBI connect('test','',...) failed: Access denied
for user 'jimk'@'localhost' (using password: NO) at t/10dsnlist.t line 45
Cannot connect: Access denied for user 'jimk'@'localhost' (using
password: NO)
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
Failed 9/9 tests, 0.00% okay

(I'll snip the rest of the tests because the same error message appeared
repeatedly.)

I thought perhaps the problem was that I was running as my own user
rather than root. But when I 'sudo'ed instead, I got the same failures,
only with 'root' substituted for 'jimk'.

[DBD-mysql-3.0002] 693 $ sudo 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..........DBI connect('test','',...) failed: Access denied
for user 'root'@'localhost' (using password: NO) at t/10dsnlist.t line 45
Cannot connect: Access denied for user 'root'@'localhost' (using
password: NO)
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
Failed 9/9 tests, 0.00% okay

The server is definitely running, but I'm at a loss as to how to
proceed, as 'make test' has failed both for 'jimk' and 'root'.
Suggestions? Thanks in advance.

Jim Keenan

Re: DBD::mysql failing to "make test"

am 20.02.2006 06:20:39 von ron

On Sun, 19 Feb 2006 22:08:52 -0500, James E Keenan wrote:

Hi James

> had been unwrapped earlier: ~/.cpan/build/DBD-mysql-3.0002. I got
> through 'perl Makefile.PL' and 'make' more or less unscathed.

more or less. Shudder :/.

> t/10dsnlist..........DBI connect('test','',...) failed: Access

That should read connect('dbi:mysql:test', etc.

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.

--
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html

Re: DBD::mysql failing to "make test"

am 20.02.2006 23:19:45 von jkeen_via_google

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-installatio n.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-se rver.html
# A.2.2. Can't connect to [local] MySQL server

http://dev.mysql.com/doc/refman/5.0/en/problems-with-mysql-s ock.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

Re: DBD::mysql failing to "make test"

am 21.02.2006 02:00:50 von ron

On Mon, 20 Feb 2006 17:19:45 -0500, James E Keenan wrote:

Hi James

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

I'm shocked by what you had to go thru.

I've never managed to compile DBD::mysql so I had no idea I had inadvertently
circumvented these problems.

Glad it all worked out in the end.

--
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html

Re: DBD::mysql failing to "make test"

am 21.02.2006 04:08:05 von jkeen_via_google

Somehow this message got to Ron Savage but it didn't get posted to the
newsgroup.

-------- Original Message --------
Subject: Re: DBD::mysql failing to 'make test'
Date: Mon, 20 Feb 2006 17:19:45 -0500
From: James E Keenan
To: Ron Savage
CC: List - DBI users
Newsgroups: perl.dbi.users
References: <20060220030853.6852.qmail@lists.develooper.com>
<2006220162039.781257@MONASH-7ADADE6D>


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-installatio n.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-se rver.html
# A.2.2. Can't connect to [local] MySQL server

http://dev.mysql.com/doc/refman/5.0/en/problems-with-mysql-s ock.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

Re: DBD::mysql failing to "make test"

am 21.02.2006 04:16:54 von jkeen_via_google

Ron Savage wrote:

> On Mon, 20 Feb 2006 17:19:45 -0500, James E Keenan wrote:
>
> Hi James
>
>
>>(Huge exhale.) This was the most difficult Perl module
>>installation I've ever faced. Thanks for your assistance.
>
>
> I'm shocked by what you had to go thru.
>
> I've never managed to compile DBD::mysql so I had no idea I had inadvertently
> circumvented these problems.
>
> Glad it all worked out in the end.
>
BTW, the problems I reported are not just mine. Similar failures have
been reported for DBD::mysql on the i686-linux architecture for version
3.00002. Cf. for example:

http://www.nntp.perl.org/group/perl.cpan.testers/255948
and
http://www.nntp.perl.org/group/perl.cpan.testers/266519

Jim Keenan