Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Proper Technique for DBD::mysql install

Thread Tools

Proper Technique for DBD::mysql install

Posts: n/a
Just wondering........

I am compiling the DBD:mysql perl modules on a Solaris 10 sparc,
machine and seem to have run into an common issue.

Here is the scenario, Solaris 10 comes with mysql 4 installed in /
usr/sfw, but I need the mysql 5 client libraries to make remote
connections to a remote mysql 5 database. So I installed mysql 5 in
another location. (down /export, because the location is
automounted.) I then compiled the DBD::mysql perl module like so:

perl Makefile.PL --testdb=remote_testdb --testuser=remote_user --
testpassword=remote_passwd --testhost=remote_host --testport=3306 --

mysql_config returns:

Usage: ./mysql_config [OPTIONS]
--cflags [-I/export/software/mysql-5/include -g -
--include [-I/export/software/mysql-5/include]
--libs [-L/export/software/mysql-5/lib -
lmysqlclient -lz -lposix4 -lgen -lsocket -lnsl -lm]
--libs_r [-L/export/software/mysql-5/lib -
lmysqlclient_r -lz -lpthread -lthread -lposix4 -lgen -lsocket -lnsl -
lm -lpthread -lthread]
--socket [/tmp/mysql.sock]
--port [0]
--version [5.0.67]
--libmysqld-libs [-L/export/software/mysql-5/lib -lmysqld -lz -
lpthread -lthread -lposix4 -lgen -lsocket -lnsl -lm -lpthread -
lthread -lrt]

I am using gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath) (which
was also used to build the perl I am using, /export/software/perl/

When I run a make I get the following warning:

Warning: duplicate function definition 'do' detected in mysql.xs, line
Warning: duplicate function definition 'rows' detected in mysql.xs,
line 650

and when I run a make test:

ERROR: install_driver(mysql) failed: Can't load './DBD-mysql-4.010/

I know what the problem is... the can't find the file.

so I have to export LD_LIBRARY_PATH to /export/software/mysql-5/lib.
Then the make and make test run properly after that.

But if I run a simple DBI connect script I get:

install_driver(mysql) failed: Can't load '/export/software/perl/v5.8.4/
lib/site_perl/5.8.4/sun4-solaris/auto/DBD/mysql/' for module
DBD::mysql: perl: fatal: open failed:
No such file or directory at /export/software/perl/v5.8.4/lib/5.8.4/
sun4-solaris/ line 230.

but yet again if I set my LD_LIBRARY_PATH it runs correctly.

So after spending the past couple of days "googling,yahooing,
etc" it seems a possible solution is to have the script like so:

unless ($ENV{BEGIN_BLOCK}) {
$ENV{LD_LIBRARY_PATH} = "/export/software/mysql-5/lib";
exec 'env',$0,@ARGV;

use strict;
use warnings;
use DBI;

my $db_user = 'remote_user';
my $db_pass = 'remote_passwd';
my $db_host = 'remote_host';
my $db_name = 'remote_db';
my $db_type = 'mysql';
my $db_port = '3306';
my $db_dsn = "DBI:$db_type:$db_name:$db_host:$db_port";

my $db_con = DBI->connect($db_dsn, $db_user, $db_pass)
|| die "Failed DB Connection: $DBI::errstr\n";


but it seems like a 1/2 a55ed solution. I would think I should be
able to compile the DBD::mysql module to have the so always look in
the directory I tell it to for the mysql client and not rely on
1 for it's library path or LD_LIBRARY_PATH.

I'm sure other people have had similar experiences. Is this the way
to go, or is there a better way to do it?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Proper technique for holding a microphone? Meat Plow Computer Support 4 09-05-2010 07:05 PM
Proper modularization technique drhowarddrfine C Programming 4 11-10-2008 07:46 PM
verifying proper vim-ruby install Mark Volkmann Ruby 14 10-12-2005 03:29 PM
How to ensure proper install of GNU GMP on Windows ? Jasper C++ 1 06-28-2004 01:21 PM
Proper way to install the Bird & the Fox? @micro$oft.linuxworx Firefox 0 04-25-2004 04:22 AM