LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem with connecting Perl with mysql (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-connecting-perl-with-mysql-4175480624/)

zak100 10-13-2013 01:09 PM

Problem with connecting Perl with mysql
 
Hi,
I am trying to connect mysql with Perl. I am using windows 7 but i found that same problem occurs on some linux plat forms also. I got following message while connecting with mysql database:
Code:

D:\Zulfi\PERL MAIN FOLDER>perl CTdb.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains:
C:/Perl64/site/lib C:/Perl64/lib .) at (eval 3) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: CSV, DBM, ExampleP, File, Gofer, ODBC, Oracle, Pg, Proxy, SQL
ite, Sponge.
 at CTdb.pl line 4.

I got one solution from the following site:
http://www.cpanelkb.net/how-to-install-perl-dbd-mysql/
which says:
Quote:

How to Install Perl DBD::MySQL, Use the following manual installation.

Below is the step,

Run from Shell.

perl -MCPAN -e shell

Type in,

cpan> install DBD::mysql

Wait for the installation.

Thats all!!

However when i executed "perl -MCPAN -e shell" command, i got following problem of locking:
Code:

C:\Users\HP>perl -MCPAN -e shell

It looks like you don't have a C compiler and make utility installed.  Trying
to install dmake and the MinGW64 gcc compiler using the Perl Package Manager.
This may take a a few minutes...

Downloading MinGW64-4.5.4...done
Downloading dmake-4.12.20090907...done
Unpacking MinGW64-4.5.4...done
Unpacking dmake-4.12.20090907...done
Generating HTML for MinGW64-4.5.4...done
Generating HTML for dmake-4.12.20090907...done
Updating files in site area...done
4601 files installed

Please use the `dmake` program to run commands from a Makefile!

Set up gcc environment - gcc.exe (rubenvb-4.5.4) 4.5.4
CPAN.pm panic: Found invalid lockfile 'C:\Perl64\cpan\.lock', please remove. Can
not proceed.


C:\Users\HP>

Can somebody plz guide me? The download takes lot of time and internet connections are not so stable. Plz help me.

Zulfi.

Robhogg 10-13-2013 01:18 PM

Well, one obvious issue is this line:

'CPAN.pm panic: Found invalid lockfile 'C:\Perl64\cpan\.lock', please remove.'

You could move this file out of the cpan directory, and try the install again.

If this doesn't work, it might be worth trying a Windows forum, for example theeldergeek.com.

On Linux, it might be better to install the versions of gcc and make supplied from your distro's repositories before trying the DBD install again.

zak100 10-13-2013 01:45 PM

Hi,
Thanks for your response. I got the solution:
Code:

C:\Users\HP>ppm install DBD::mysql
Downloading DBD-mysql-4.022...done
Unpacking DBD-mysql-4.022...done
Generating HTML for DBD-mysql-4.022...done
Updating files in site area...done
  12 files installed

Zulfi.


All times are GMT -5. The time now is 03:45 AM.