On 8/3/06, Sherm Pendley <[EMAIL PROTECTED]> wrote:
On Aug 3, 2006, at 10:41 AM, Jay Savage wrote:

> The only caveat I can think of is that the tests assume you're
> installing DBD::mysql against a fresh MySQL installation with the root
> password still unset.

They assume no such thing. They don't even assume that the server
against which you're going to run the tests is on the same machine.

I believe you, but this clearly contradicts docs, and the information
provided by MySQL themselves, see the MySQL reference manual at
http://www.mysql.org/doc/refman/5.1/en/perl-installation.html. The
relevant portion is " The DBD::mysql installation runs a number of
tests. These tests attempt to connect to the local MySQL server using
the default username and password. (The default username is your login
name on Unix, and ODBC on Windows. The default password is "no
password.") "

Assuming that you run cpan via sudo, that means the tests attempt to
connect to the database as root, with no password. That's pretty clear
from the docs and, in fact, matches observed behavior.

Detailed instructions are provided with the module that detail how to
provide the user name, password, host name, and other information
with which to run the tests.


Indeed there are some arcane libs options and command line switches
buried in INSTALL.

Ok, I'll turn off the sarcasm, they're not really that obscure. But
few things in life bug me more than CPAN modules that can be installed
via normal CPAN methods.

> If you've already configured MySQL and set the
> root password, the tests will all fail.

No, the tests will fail if you haven't provided the necessary
information for them to connect. The root password *IS NOT*
necessary. You don't have to run the tests as root either - current
CPAN.pm versions allow you to run the first few steps of module
building and testing as an ordinary user, and run the final step as
"sudo make install".


That's a very interesting point about recent CPAN.pm versions, I'll
have to look into that, thanks!

We're going to have to quibble over the definition of "requires,"
though. "fails by default unless I go in a change the source and/or
makefile" fits my working definition of "requires."

The only requirement for the tests is that the test database (which
need not be named 'test') exists, and that the test user is fully
authorized to perform any operation on that database. It will need to
create and drop tables, perform queries, insert and delete rows, etc.


I think we're quibbling over sematics here. But let me change that to
"By default the tests will be run as the current user with a password
of ''. Under normal circumstances (i.e. "sudo -MCPAN -e'install...")
that means the tests will require that root be able to connect to a
running MySQL server on the local machine with a null password."

> Since it's a pretty stable
> module, it's usually safe to just go ahead and force install

Agreed - provided that the tests failed with "failed to log in"
errors and not some other error.

> , but you
> may want to unset to root password during the installation to run the
> tests.

Worst. Advice. Ever.

You absolutely DO NOT want to open up a huge gaping security hole in
your database.


Obviously my assumption here is that installing DBD::mysql is one of
the first steps in setting up a new mysql installation. In fact,
default configuration will fail to install if the database is anything
other than a clean installation. That may, of course, be a faulty
assumption, and I certainly wouldn't advise anyone to unset the root
password--or any other password--on a live database accepting
connections from the network.


In the CPAN shell, run the "look DBD::mysql" command. This will
download the latest tarball and unpack it, then open up a subshell so
that you can run the other commands manually.

In the subshell, run "open INSTALL.html" to open the installation
docs in your default web browser. Under the "Source Installation"
section, there's a "Configuration" section, where a number of options
are listed that you can pass to "Makefile.PL". Determine what options
you want to use, then run the commands.

For example, if I wanted to connect to the 'testme' database on
'mydbserver.invalid', and log in as 'nobody_special' with password
'lemmein', I'd run this sequence of commands:

        perl Makefile.PL --testdb=testme --testhost=mydbserver.invalid --
testuser=nobody_special --testpassword=lemmein
        make
        make test
        sudo make install

Depending on how you've configured your CPAN shell - i.e. whether
you're already running as root or not - you may not need to use
"sudo" with the last step.

When you're done, use 'exit' or ctrl-d to leave the subshell and get
back up to the CPAN shell.

This is probably one of the best and most concise explanation I've
ever seen of CPAN.pm's advanced features. Thanks again!

-- j
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to