MYSQL devel files in ubuntu and installing perl DBD::mysql

29 December 2009

I am using the fantastic local::lib with ubuntu 9.04. That is great, but  not following the easy way (aka ‘aptitude’) and having full control managing all the perl modules with CPAN, has its downside: the installation of  the hard-to-install-modules like DBI and GD

PROBLEMS:
A- where is myql_config script? DBD::mysql use it for finding where you have all the mysql things
B- where is now the mysql-devel package?

A) Not found until solved B.

mysql_config is not installed until you install the mysql-devel !!!

linux:~/.cpan/build/DBD-mysql-4.013-tjvDzy$ mysql_config
Usage: /usr/bin/mysql_config [OPTIONS]
Options:
–cflags         [-I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing]
–include        [-I/usr/include/mysql]
–libs           [-Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient]
–libs_r         [-Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient_r]
–socket         [/var/run/mysqld/mysqld.sock]
–port           [0]
–version        [5.0.75]
–libmysqld-libs [-Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqld -lwrap -lrt]

B) The msyql devel is no longer in ubuntu (at least with this name)

linux:~/.cpan/build/DBD-mysql-4.013-tjvDzy$ sudo aptitude search mysql | grep devel
p   liblua5.1-sql-mysql-dev         – luasql development files for the lua langu
p   libmysql++-dev                  – MySQL C++ library bindings (development)
p   libmysqlclient15-dev            – MySQL database development files
p   libmysqlclient16-dev            – MySQL database development files

Seems that now is called  libmysqlclient15-dev

Searching in the web:
http://ubuntuforums.org/showthread.php?t=556317
a lot of people have had the same problem and they say that ‘ libmysql++-dev’ works ok

What I was not able to find is what is the difference between libmysqlclient15-dev and libmysqlclient16-dev. I have mysql-5.0 installed but in the repostiroty there is also the 5.1. Are the libmysqlcientxx-devel specific for each msyql version?

# installing the libmysql++-dev
> sudo aptitude install libmysql++-dev
The following NEW packages will be installed:
libmysql++-dev libmysql++3{a} libmysqlclient15-dev{a}

==intalled devel files ==

== Try to install DBD::mysql with CPAN==

cpan[12]> install DBD::mysql

‘/home/pablo/localperl/bin/perl Makefile.PL’ returned status 512, won’t make
Running make test
Make had some problems, won’t test
Running make install
Make had some problems, won’t install

* try it manually

pablo@pmg-linux:~/.cpan/build/DBD-mysql-4.013-2mMMny$ perl Makefile.PL

PLEASE NOTE:

For ‘make test’ to run properly, you must ensure that the
database user ‘pablo’ 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 ‘pablo’@’localhost’ identified by ‘s3kr1t’;

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

perl Makefile.pl –testuser=username

I will use the following settings for compiling and testing:

cflags        (mysql_config) = -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing
embedded      (mysql_config) =
libs          (mysql_config) = -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient
mysql_config  (guessed     ) = mysql_config
nocatchstderr (default     ) = 0
nofoundrows   (default     ) = 0
ssl           (guessed     ) = 0
testdb        (default     ) = test
testhost      (default     ) =
testpassword  (default     ) =
testsocket    (default     ) =
testuser      (guessed     ) = pablo

To change these settings, see ‘perl Makefile.PL –help’ and

# Before installing, it would be good to have a test database and give rights to the my user:
$ mysql -u root -p
mysql> grant all privileges on test.* to ‘pablo’@’localhost’;
mysql> create database test;
$ cd ~/.cpan/build/DBD-mysql-4.013-2mMMny
$
perl Makefile.PL

$ make

$ make test
All tests successful.
Files=36, Tests=745, 15 wallclock secs ( 0.24 usr  0.97 sys +  1.47 cusr  7.16 csys =  9.84 CPU)
Result: PASS

$ make install

—-

After installing it manually I did the installation again from CPAN with the CPAN shell into my local-lib and it worked ok! Well I was expecting it to warn me that was already installed but it was installed again instead.