CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: DBI:
access database using DBD::mysql


New User

Jun 10, 2008, 12:18 AM

Post #1 of 3 (10188 views)
access database using DBD::mysql Can't Post

Hi everyone,

I am new to PERL and I have to create a script that will connect to a database(this database is in another server).

I found out I have to install DBI and DBD::mysql. So I installed the DBI module using -mCPAN and I think it is doing fine.

But when I want to install DBD::mysql, I got a problem.

First, I tried using perl -MCPAN -e "install DBD::mysql". But it did not work (or I thought so.). Result :

Code Going to build C/CA/CAPTTOFU/DBD-mysql-4.007.tar.gz 

Use of uninitialized value $ENV{"USER"} in concatenation (.) or string at Makefi
le.PL line 500.
Use of uninitialized value in concatenation (.) or string at Makefile.PL line 50


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

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

perl --testuser=username

Failed to determine directory of mysql.h. Use

perl Makefile.PL --cflags=-I<dir>

to set this directory. For details see the INSTALL.html file,
section "C Compiler flags" or type

perl Makefile.PL --help
Warning: No success on command[C:\Perl\bin\perl.exe Makefile.PL INSTALLDIRS=site
C:\Perl\bin\perl.exe Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install

Then, tried using perl Makefile.PL in the folder where i save the DBD::mysql source. The result is almost the same message as the previous command.

Finally, i found out about ppm install DBD-mysql.
I type the following command in the command line:
C:\Perl\bin>perl -w ppm-shell
ppm>install DBD-mysql
Result : ppm install failed: Can't find any package that provides DBD-mysql

I even tried :
ppm> rep add PPM2
ppm>install DBD-mysql
But it is still the same.

I am really confused.

Could anyone explained to me how to install/use this module? is there any other alternative i can use to connect to the mysql database?

Oh FYI, i ve already set the http_proxy and ftp_proxy. i use ActivePerl- i am using windows xp. my database is in another machine (not in my localhost) and has username and password.

Any help would be very very very appreciated. If there is some more information i have to provide, just tell me.

Thanks a lot.

(This post was edited by inair on Jun 10, 2008, 1:17 AM)


Jun 10, 2008, 10:42 AM

Post #2 of 3 (10158 views)
Re: [inair] access database using DBD::mysql [In reply to] Can't Post

Do these instructions work for you?

New User

Jun 10, 2008, 7:36 PM

Post #3 of 3 (10142 views)
Re: [meloyelo] access database using DBD::mysql [In reply to] Can't Post

thanks for your reply meloyelo....

i tried the URL u suggested. but unfortunately the installer is not supporting windows.

is there any other way to install dbd::mysql in windows?

now i keep getting this error message :

You're using Microsoft Visual C++ compiler or similar but 
the LIB and INCLUDE environment variables are not both set.

You need to run the VCVARS32.BAT batch file that was supplied
with the compiler before you can use it.

A copy of vcvars32.bat can typically be found in the following
directories under your Visual Studio install directory:
Visual C++ 6.0: vc98\bin
Visual Studio .NET: vc7\bin

Find it, run it, then retry this.

If you think this error is not correct then just set the LIB and
INCLUDE environment variables to some value to disable the check.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives