Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've updated mysql (client+server+dev) from the rpms available on mysql.com.

rpm -i MySQL-server-5.5.14-1.linux2.6.x86_64.rpm
rpm -i MySQL-client-5.5.14-1.linux2.6.x86_64.rpm
rpm -i MySQL-devel-5.5.14-1.linux2.6.x86_64.rpm

now, a script that used to connect to another server says:

perl: symbol lookup error: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so: undefined symbol: mysql_init

the script:

use DBI;

$dsn="db";
$host="my.host.ip";
$user="anonymous"; 
$password="";
# Connect to the database.
 $dbh= DBI->connect("DBI:mysql:host=$host;database=$dsn",$user, $password,{'RaiseError' => 1});

So, I've reinstalled DBI-1.616 and DBD-mysql-4.019 from the sources. for DBD-mysql, Make test says:

$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base....................ok 1/6                                           
#   Failed test 'use DBD::mysql;'
#   in t/00base.t at line 21.
#     Tried to use 'DBD::mysql'.
#     Error:  Can't load '/usr/local/package/DBD-mysql-4.019/blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: /usr/local/package/DBD-mysql-4.019/blib/arch/auto/DBD/mysql/mysql.so: undefined symbol: mysql_get_server_version at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230.
#  at (eval 6) line 2
# Compilation failed in require at (eval 6) line 2.
# BEGIN failed--compilation aborted at t/00base.t line 21.
t/00base....................NOK 2FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 9

How can I fix this problem ?

Thanks !

share|improve this question

2 Answers 2

up vote 1 down vote accepted

OK, I've got the solution. As far as I understand, the mysql distribution I used is statically linked. So when DB:mysql is installed, it needs to be compiled with those static libraries:

  mkdir /tmp/mysql-static
  cp /usr/lib64/mysql/*.a /tmp/mysql-static
  perl Makefile.PL --libs="-L/tmp/mysql-static -lmysqlclient"
  make
  make test
  make install
  rm -rf /tmp/mysql-static
share|improve this answer

The fact that DBD-mysql now can't find the symbol mysql_get_server_version suggests that the newer MySQL client library you've installed probably lacks that particular function (or has renamed it, or something). Given that you don't provide information on what you upgraded to, or from, it's difficult to investigate and give you the full answer handed to you on a plate, but I'd be inclined to try a DBD-mysql upgrade, on the basis that a non-backwards-compatible API change may be involved, and a newer DBD-mysql version might handle it better.

share|improve this answer
    
Thanks, I've updated my question: I've added the rpm, DB, DBI versions. –  Pierre Jul 27 '11 at 9:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.