Install DBD::mysql

image_print

If the installation with CPAN

perl -MCPAN -e 'install DBD::mysql

does not work

Running install for module 'DBD::mysql'
Checksum for /root/.cpan/sources/authors/id/M/MI/MICHIELB/DBD-mysql-4.041.tar.gz ok
Configuring M/MI/MICHIELB/DBD-mysql-4.041.tar.gz with Makefile.PL
Can't exec "mysql_config": No such file or directory at Makefile.PL line 88.

Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!


PLEASE NOTE:

For 'make test' to run properly, you must ensure that the
database user 'root' can connect to your MySQL server
and has the proper privileges that these tests require such
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others.

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';

You can also optionally set the user to run 'make test' with:

perl Makefile.PL --testuser=username

Can't exec "mysql_config": No such file or directory at Makefile.PL line 561.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Failed to determine directory of mysql.h. Use

  perl Makefile.PL --cflags=-I<dir>

to set this directory. For details see DBD::mysql::INSTALL,
section "C Compiler flags" or type

  perl Makefile.PL --help
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
  MICHIELB/DBD-mysql-4.041.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Failed during this command:
 MICHIELB/DBD-mysql-4.041.tar.gz              : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512

cpan[1]> exit

then you should use apt to install the module.

apt-get install libdbd-mysql-perl
perl -e 'use DBI;for(DBI->available_drivers) { print "-$_-\n"; }'
-DBM-
-ExampleP-
-File-
-Gofer-
-Proxy-
-Sponge-
-mysql-