Fwd: DBD::mysql OS X

2006-08-03 Thread Jay Savage

nd again with the reply-to.

-- Forwarded message --
From: Jay Savage [EMAIL PROTECTED]
Date: Aug 3, 2006 10:40 AM
Subject: Re: DBD::mysql OS X
To: Walter Copenhaver [EMAIL PROTECTED]


On 8/3/06, Walter Copenhaver [EMAIL PROTECTED] wrote:

Hello,

Has someone manage to install DBD::mysql in Mac X Tiger.  Can anyone point
me to a tutorial or
how to do this.

Thanks




Walter,

Can you tell us specifically what problems you're having and what
errors you're seeing? Installations usually go pretty smoothly. Just:

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

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. If you've already configured MySQL and set the
root password, the tests will all fail. Since it's a pretty stable
module, it's usually safe to just go ahead and force install, but you
may want to unset to root password during the installation to run the
tests. You'll also have to force install if the the server you're
planning to use is on a different machine. You can read all about it
at http://www.mysql.org/doc/refman/5.1/en/perl-installation.html, but
here's the relevant part:

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.) If
you cannot connect to the server with those values (for example, if
your account has a password), the tests fail. You can use force
install DBD::mysql to ignore the failed tests.

Some other common issues are at
http://www.mysql.org/doc/refman/5.1/en/perl-support-problems.html, but
they shouldn't apply to OS X.

HTH,

-- jay
--
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!


--
--
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!


Re: DBD::mysql OS X

2006-08-03 Thread Sherm Pendley

On Aug 3, 2006, at 10:41 AM, Jay Savage wrote:


On 8/3/06, Walter Copenhaver [EMAIL PROTECTED] wrote:

Hello,

Has someone manage to install DBD::mysql in Mac X Tiger.  Can  
anyone point

me to a tutorial or
how to do this.

Thanks




Walter,

Can you tell us specifically what problems you're having and what
errors you're seeing? Installations usually go pretty smoothly. Just:

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

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.  
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.



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.


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.



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.



You'll also have to force install if the the server you're
planning to use is on a different machine.


Nonsense. If the server you want to run the tests against is on  
another machine, simply provide a hostname (and port number if  
needed) in addition to the username, password, and other connection  
information.


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.


sherm--

Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net




Re: DBD::mysql OS X

2006-08-03 Thread Jay Savage

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; [  ]

Re: DBD::mysql OS X

2006-08-03 Thread Sherm Pendley

On Aug 3, 2006, at 2:02 PM, Jay Savage wrote:


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


It's worth keeping in mind that MySQL AB is neither the author nor  
the maintainer of DBD::mysql. It's certainly nice that they've  
provided a brief summary of the most common scenario, but it's a  
mistake to view that summary as being authoritative.



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.


Yes, it does. The MySQL AB summary is correct as far as it goes, but  
it *is* just a summary, and as such it's incomplete by nature. It  
describes the default situation, but it doesn't go into detail as to  
what options are available for overriding the defaults. Nor should it  
- that's what the module documentation itself is for.


The final word, as always, is the documentation provided by the  
module author. That trumps any and all advice given by third parties  
- including my own. :-)



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.


It's certainly a problem, I agree. Although, I view it as more of a  
social problem than a technical one. Clearly it wouldn't be very  
difficult in principle for a module to provide a list of its install  
options, along with a brief description of each and its default value.


The problem is that there is no standardized means for a module to  
provide such a list, and therefore no means for something like  
CPAN.pm to determine what options are available and how they should  
be set.


Module authors over the years have used various different approaches  
of specifying different options. Some modules (DBD::Pg) use  
environment variables, others use options passed to Makefile.PL  
(DBD::mysql), while others use an interactive QA session (CPAN.pm).  
Getting all of the various module authors to agree on a common  
standardized approach would be like herding cats.


In the absence of such standardization, the best thing CPAN.pm can do  
is offer the look command, for downloading and unwrapping the  
latest version of a module which needs some manual hand-holding for  
the actual installation process.


sherm--

Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net