LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   DBD installation trouble .. installation steps attached (https://www.linuxquestions.org/questions/linux-server-73/dbd-installation-trouble-installation-steps-attached-604655/)

utw-mephisto 12-05-2007 06:59 AM

DBD installation trouble .. installation steps attached
 
Hiya,

I have a huge problem with getting DBD::mysql to work or to install for that matter.
I am using Fedora Core 8 - 32 Bit and I end up getting the same error.

I have now installed Fedora one more time and logged all my steps I have taken.

So if you are able to help me you can see here at least what I have done and where I missed something in the process.

So, DVD in, installation fired up and after giving IPs and such, these are the steps taken

Packages installed during the installation (customized package selection)

Applications
- Editors
- Text-based Internet

Development
- Development Libraries
- Development Tools
- Ruby
- Web Development

Base System
- Base

After reboot I run first

yum update

After that I have installed some shizzle I usually install (not even sure if we need it lol)

So I yum'ed the following as well
Quote:

freetype-devel
libpng-devel
libjpeg-devel
gd-devel
libxml-devel
libxml2-devel
openssl-devel
Then I removed some security shizzle I don't need

Quote:

rpm -e firstboot-tui-1.4.39-1.fc8.noarch
rpm -e system-config-firewall-tui-1.0.11-1.fc8.noarch
rpm -e iptables-ipv6-1.3.8-6.fc8.i386
rpm -e iptstate-2.2.1-1.fc8.i386
rpm -e iptables
Disabled SELINUX
Quote:

vi /etc/selinux/config
Changed
SELINUX=enforcing
to
SELINUX=disabled
Added another user

Installed ntp and changed settings to our internal time server

Quote:

vi /etc/ntp.conf
chkconfig --add ntp
chkconfig ntpd on 345
ntpdate <IP>
service ntpd start
Append /usr/local/lib to the ld.so.config and run ldconfig

Edited sshd.config to stop SSH from timing out

Downloaded mysql (mysql-standard-5.0.27-linux-i686-glibc23.tar.gz)
Installed mysql
Quote:

tar zxvf mysql-standard-5.0.27-linux-i686-glibc23.tar.gz
mv mysql-standard-5.0.27-linux-i686-glibc23 mysql
mv mysql /usr/local/
cd /usr/local/mysql/
groupadd mysql
useradd -g mysql mysql
scripts/mysql_install_db --datadir=/home/mysql
Edited the mysql.server file to configure the application base folder
Quote:

vi support-files/mysql.server
basedir=/usr/local/mysql
datadir=/home/mysql

then
datadir=/home/mysql
fi
Edited the my-medium.cnf to remove replicatin support and alter maximum connections value

in [mysqld] added
Quote:

max_connections = 2000
commented out replication line
Quote:

#log-bin=mysql-bin
copied / renamed the two files into their final places
Quote:

cp support-files/mysql.server /etc/init.d
cp support-files/my-medium.cnf /etc/my.cnf
Set mySQL autostart and link to key mysql applications
Quote:

chkconfig mysql.server on 345
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/mysqladmin
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
ln -s /usr/local/mysql/bin/mysqlimport /usr/bin/mysqlimport
ln -s /usr/local/mysql/bin/mysqlhotcopy /usr/bin/mysqlhotcopy
Changed owner and group ownership
Quote:

chown -R mysql:mysql /home/mysql/
chgrp -R mysql /usr/local/mysql/
chmod 755 /etc/init.d/mysql.server
Starting mysql
Quote:

service mysql.server start
Changed current empty password to a decent one
Quote:

mysqladmin -u root -p password <password>
Secure mysql
Quote:

mysql -u root -p
mysql> use mysql
Database changed
mysql> delete from user where user=";
"> delete from user where host !='localhost';
"> update user set host='%';
"> update user set password=password('<Password>');
"> "
"> ;
exit
Restart mysql
Quote:

service mysql.server restart
Now the part to get Perl shizzle running (where the problem actually is)
Quote:

export LANG=C
perl -MCPAN -e shell
Error : Can't locate CPAN.pm in @INC
So I used yum to install cpan
Quote:

yum install cpan
Another try
Quote:

perl -MCPAN -e shell
Are you ready for manual configuration? [yes] < I said NO
install CPAN
install Bundle::libnet
install DBI
install DBD::mysql

Errors
Can't exec "mysql_config": No such file or directory at Makefile.PL line 466.
Failed 25/28 test programs. 10/15 subtests failed.
make: *** [test_dynamic] Error 255
RIght, so I added mysql_config to path
Quote:

export PATH=$PATH:/usr/local/mysql/bin/
Running the same command again returns a lot of errors as well, some I cannot catch as it runs too fast, but most of them

Quote:

CPAN: File::Temp loaded ok (v0.16)

CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-4.005.tar.gz

I will use the following settings for compiling and testing:

cflags (mysql_config) = -I/usr/local/mysql/include/mysql
embedded (mysql_config) =
libs (mysql_config) = -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testsocket (default ) =
testuser (default ) =

To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.

Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -lmysqlclient
Using DBI 1.601 (for perl 5.008008 on i386-linux-thread-multi) installed in /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::mysql
Could not read '/root/.cpan/build/DBD-mysql-4.005-XGQ84Q/META.yml'. Falling back to other methods to determine prerequisites

-- snip --

dbdimp.c:4347: error: 'MYSQL' undeclared (first use in this function)
dbdimp.c:4347: warning: statement with no effect
dbdimp.c:4347: error: expected ';' before 'save_socket'
dbdimp.c:4357: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c:4357: error: 'CR_SERVER_GONE_ERROR' undeclared (first use in this function)
dbdimp.c:4357: warning: comparison between pointer and integer
dbdimp.c:4361: error: 'imp_dbh_t' has no member named 'auto_reconnect'
dbdimp.c:4375: error: 'save_socket' undeclared (first use in this function)
dbdimp.c:4375: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c:4375: warning: statement with no effect
dbdimp.c:4376: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c:4376: warning: passing argument 3 of 'memcpy' makes integer from pointer without a cast
dbdimp.c:4377: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c:4377: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c:4377: warning: passing argument 3 of 'memset' makes integer from pointer without a cast
dbdimp.c:4381: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c:4381: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c:4382: warning: passing argument 3 of 'mysql_dr_error' makes pointer from integer without a cast
dbdimp.c:4383: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c:4383: warning: passing argument 3 of 'memcpy' makes integer from pointer without a cast
dbdimp.c:4384: error: 'imp_dbh_t' has no member named 'stats'
dbdimp.c:4384: error: request for member 'auto_reconnects_failed' in something not a structure or union
dbdimp.c:4384: error: invalid lvalue in increment
dbdimp.c:4384: warning: statement with no effect
dbdimp.c:4387: error: 'imp_dbh_t' has no member named 'stats'
dbdimp.c:4387: error: request for member 'auto_reconnects_ok' in something not a structure or union
dbdimp.c:4387: error: invalid lvalue in increment
dbdimp.c:4387: warning: statement with no effect
dbdimp.c: In function 'mysql_db_quote':
dbdimp.c:4544: warning: implicit declaration of function 'mysql_real_escape_string'
dbdimp.c:4544: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c: In function 'mysql_db_last_insert_id':
dbdimp.c:4559: error: 'imp_dbh_t' has no member named 'mysql'
dbdimp.c:4559: warning: passing argument 2 of 'Perl_sv_2mortal' makes pointer from integer without a cast
make: *** [dbdimp.o] Error 1
CAPTTOFU/DBD-mysql-4.005.tar.gz
/usr/bin/make -- NOT OK
Warning (usually harmless): 'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
CAPTTOFU/DBD-mysql-4.005.tar.gz : make NO
I tried the a force install

which returned pretty much the same errors ...

I have tried now yum to install DBD which SEEMS to be ok, but I still don't know whether it is installed correctly or not

Quote:

yum install perl-DBD-MySQL
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package perl-DBD-MySQL.i386 0:4.005-2.fc8.1 set to be updated
--> Processing Dependency: libmysqlclient.so.15 for package: perl-DBD-MySQL
--> Processing Dependency: perl(DBI) for package: perl-DBD-MySQL
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: perl-DBD-MySQL
--> Processing Dependency: perl(DBI::Const::GetInfoType) for package: perl-DBD-MySQL
--> Running transaction check
---> Package perl-DBI.i386 0:1.58-2.fc8 set to be updated
---> Package mysql-libs.i386 0:5.0.45-4.fc8 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
perl-DBD-MySQL i386 4.005-2.fc8.1 fedora 143 k
Installing for dependencies:
mysql-libs i386 5.0.45-4.fc8 fedora 1.5 M
perl-DBI i386 1.58-2.fc8 fedora 715 k

Transaction Summary
=============================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 2.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): mysql-libs-5.0.45- 100% |=========================| 1.5 MB 00:00
(2/3): perl-DBI-1.58-2.fc 100% |=========================| 715 kB 00:00
(3/3): perl-DBD-MySQL-4.0 100% |=========================| 143 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: mysql-libs ######################### [1/3]
warning: /etc/my.cnf created as /etc/my.cnf.rpmnew
Installing: perl-DBI ######################### [2/3]
Installing: perl-DBD-MySQL ######################### [3/3]

Installed: perl-DBD-MySQL.i386 0:4.005-2.fc8.1
Dependency Installed: mysql-libs.i386 0:5.0.45-4.fc8 perl-DBI.i386 0:1.58-2.fc8
Complete!
So ANY help is highly appreciated ...

chrism01 12-05-2007 11:57 PM

Well now you have to write a short Perl prog to connect to the DB and see if it works.
something like this:

Code:

#!/usr/bin/perl -w
use DBI;                # Database connections
use strict;            # Enforce declarations

# Declare Config pkg so we can refer to it anywhere
{
    package cfg;
}

# Connect to DB
db_connect();

sub db_connect
{
    my (
        $dsn,  # data source name
        );

    # Create data source string and connect ...
    # Local/target DB
    $dsn = "DBI:mysql:".
          "database=".$cfg::params{'DB_NAME'}.";".
          "host=".$cfg::params{'DB_HOST'}.";".
          "port=".$cfg::params{'DB_PORT'};
    $cfg::dbh = DBI->connect( $dsn, $cfg::params{'DB_USER'},
                                $cfg::params{'DB_PASSWD'},
                                {RaiseError => 0, PrintError => 0,
                                AutoCommit => 0} );

    if( $DBI::errstr)
    {
        exit_with_error($DBI::errstr);
    }
}

This is a shortcut ver of my real code. You'll need to replace the database/host/port/user/passwd strings. (default port is 3306).
exit_with_error() is my own error handler. Just use the print cmd.
Perl docs here: http://perldoc.perl.org/index.html
HTH


All times are GMT -5. The time now is 07:50 AM.