MySQL Perl support requires that you have installed MySQL client programming support (libraries and header files). Most installation methods install the necessary files. However, if you installed MySQL from RPM files on Linux, be sure that you've installed the developer RPM. The client programs are in the client RPM, but client programming support is in the developer RPM.
If you want to install Perl support, the files you need can be obtained from the CPAN (Comprehensive Perl Archive Network) at http://search.cpan.org.
The easiest way to install Perl modules on Unix is to use the
CPAN
module. For example:
shell> perl -MCPAN -e shell
cpan> install DBI
cpan> install DBD::mysql
The DBD::mysql
installation runs a number of
tests. These tests attempt to connect to the local MySQL server
using the default user name and password. (The default user name
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.
DBI
requires the
Data::Dumper
module. It may be installed; if
not, you should install it before installing
DBI
.
It is also possible to download the module distributions in the form of compressed tar archives and build the modules manually. For example, to unpack and build a DBI distribution, use a procedure such as this:
Unpack the distribution into the current directory:
shell> gunzip < DBI-VERSION
.tar.gz | tar xvf -
This command creates a directory named
DBI-
.
VERSION
Change location into the top-level directory of the unpacked distribution:
shell> cd DBI-VERSION
Build the distribution and compile everything:
shell>perl Makefile.PL
shell>make
shell>make test
shell>make install
The make test command is important because it
verifies that the module is working. Note that when you run that
command during the DBD::mysql
installation to
exercise the interface code, the MySQL server must be running or
the test fails.
It is a good idea to rebuild and reinstall the
DBD::mysql
distribution whenever you install a
new release of MySQL, particularly if you notice symptoms such as
that all your DBI
scripts fail after you
upgrade MySQL.
If you do not have access rights to install Perl modules in the system directory or if you want to install local Perl modules, the following reference may be useful: http://servers.digitaldaze.com/extensions/perl/modules.html#modules
Look under the heading “Installing New Modules that Require Locally Installed Modules.”
User Comments
I ran into the same problem after installing MySQL from RPM. Turns out that you must install MySQL-devel* (ie: Libraries and header files) as well as MySQL-client* and MySQL-server*.
Note that if you've been a good doobie and already changed the root password then the DBD::mysql tests will fail.
If you try to install DBD::mysql on RedHat 8/9 and get this error message repeated over and over:
Unsuccessful stat on filename containing newline at /usr/lib/perl5/5.8.0/ExtUtils/Liblist/Kid.pm line 97.
then try typing "unset LANG" and then do it again.
Source: http://lists.mysql.com/perl/2840
I have got into lots of Test errors while installing DBD::mysql. These errors were like "all skipped: ERROR: Access denied for user 'root'@'localhost' (using password: NO). Can't continue test". So what I did at cpan shell:
cpan>o conf makepl_arg "--testuser=root --testpass=root123"
It dictates CPAN to use ROOT user and its password. Then install was Ok.
Add your own comment.