Installing DBD::MySql

I had spent last two days trying to install DBD::MySql version-4.005 for mySql 5.1-22.0 rc.

After a lot of permutation and combination finally able to get it done. I have seen a lot of discussion forums but not able to get the root cause of the problem finally I figured out that it was related with MySql Devel rpm and static linking of My sql Client Library.

This is a known issue with DBD::MySql. It fails if you try linking MySql Client library Dynamically.

The steps I followed after going through DBD::MySql documentation are as follows:

1. Install Mysql-Client rpm
2. Install MySql-Devel Library
3. Install MySql Shared Libraries

  • MySQL-client-community-5.1.22-0.rhel
  • MySQL-devel-5.1.22-0.glibc23
  • MySQL-shared-compat-5.1.22-0.rhel4
Installing DBD::MySql

1. tar xvzf DBD-mysql-.tar.gz
2. cd DBD-mysql-
3. cp /usr/lib/mysql/*.a /tmp/mysql-static (to link libmysql.client.a statically)
4. perl Makefile.PL --libs="-L/tmp/mysql-static -lmysqlclient" --testuser=user --testpassword=pass
5. make
6. make test
7. make install

All tests passed successfully.