Problème Module DBI DBD::mysql
Bonjour,
Je n'ai pas trouvé de post proposant une solution à mon problème, je vais donc essayer d'être précis afin de demander votre aide.
J'utilise:
Windows XP & Cygwin
perl, v5.10.0
MySQL 5.1.44
Toad for MySQL Beta 4.6.0.522
Sujet:
Se connecter à ma base MySQL au travers d'un script en Perl afin d'afficher/intégrer des données.
Ci-dessous le script de test que j'utilise de ce tutorial
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| #! /usr/bin/perl -w
use DBI;
use strict;
# infos connexion
my $user= "root";
# passe de compte
my $password= "dbb";
# ip du serveur Mysql cible
my $host= "127.0.0.1";
# database est la table mysql visée
my $dbh= DBI->connect("dbi:mysql:database=dbb_report;host=$host",$user,$password)
or die $DBI::errstr;
# requete SQL
my $sth= $dbh->prepare("SELECT * FROM zz_operator")
or die $DBI::errstr;
$sth->execute();
# Intégration des données dans des colonnes
my $numRows = $sth->rows;
my @row;
# boucle pour affichage de tout les résulats
while ( @row = $sth->fetchrow_array )
{
print $row[1];
}
$dbh->disconnect or die $DBI::errstr; |
Au lieu de m'afficher les données j'obtiens ce message d'erreur:
Code:
1 2 3 4 5 6
| $ perl test.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/lib/perl5/5.10/i686-cygwin /usr/lib/perl5/5.10 /usr/lib/perl5/site_perl/5.10/i686-cygwin /usr/lib/perl5/site_perl/5.10 /usr/lib/perl5/vendor_perl/5.10/i686-cygwin /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) 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: DBM, ExampleP, File, Gofer, Proxy, Sponge.
at test.pl line 12 |
C'est un message décrit par le tutorial pouvant arriver et préconise de réinstaller les 3 modules ce dont j'ai fais.
J'ai effectivement un problème sur l'un des 3 modules.
J'utilise Windows, donc via Cygwin je fais:
>cpan
>install Bundle::DBD::mysql
J'obtiens en message
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| cpan[1]> install Bundle::DBD::mysql
CPAN: Storable loaded ok (v2.18)
Going to read /home/ngarnero/.cpan/Metadata
Database was generated on Sun, 28 Feb 2010 12:43:35 GMT
CPAN: YAML loaded ok (v0.66)
Going to read /home/ngarnero/.cpan/build/
............................................................................DONE
Found 20 old builds, restored the state of 18
DBI is up to date (1.609).
Running install for module 'DBD::mysql'
Running make for C/CA/CAPTTOFU/DBD-mysql-4.013.tar.gz
Has already been unwrapped into directory /home/ngarnero/.cpan/build/DBD-mysql-4.013-lfzUh9
'/usr/bin/perl5.10.0.exe Makefile.PL' returned status 512, won't make
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install |
Je suis allé sur le site de cpan et j'ai téléchargé DBD-mysql-4.011.tar.gz
Via Cygwin je fais donc:
perl Makefile.PL
J'obtiens:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Can't exec "mysql_config": No such file or directory at Makefile.PL line 76.
Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
PLEASE NOTE:
For 'make test' to run properly, you must ensure that the
database user 'ngarnero' 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 'ngarnero'@'localhost' identified by 's3kr1t';
You can also optionally set the user to run 'make test' with:
perl Makefile.pl --testuser=username
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located
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 |
Je suis donc bloqué, je n'arrive pas à trouver de solution à mon problème et ce "Can't find mysql_config".
Merci d'avance pour votre aide.