为什么 mysqldumpslow.pl 在 Windows 上找不到任何 Perl 模块? [英] Why can't mysqldumpslow.pl find any Perl modules on Windows?
问题描述
我正在尝试从命令行解析 MYSQL 慢查询日志.
I'm trying to parse a MYSQL slow query log from the command line.
输入后:
set PATH=G:\xampp\perl\bin\;%PATH%
cd /d G:\xampp\mysql\scripts
perl mysqldumpslow.pl -s c -t 10
shell 返回错误 can't locate strict.pm in @INC (@INC contains: .) at mysqldumpslow.pl at line 8. BEGIN failed
The shell returns an error can't locate strict.pm in @INC (@INC contains: .) at mysqldumpslow.pl at line 8. BEGIN failed
在xampp的perl
目录下,只有一个文件perl.exe
.
In the perl
directory in xampp, there is only one file perl.exe
.
我是否缺少 perl 模块/库?阅读此日志文件需要什么?
Am I missing perl modules/libraries? What do I need to read this log file?
推荐答案
一种解决方法是在您的 perl 安装中找到 strict.pm
的位置,并将该目录添加到 PERL5LIB
环境变量,或调用 perl
与-I/path/to/strict.pm/directory
选项(见 perlfaq8
:如何将目录添加到我的包含路径 (@INC)在运行时?).
A workaround is to find the location of strict.pm
in your perl installation and to add the directory to the PERL5LIB
environment variable, or to invoke perl
with the
-I/path/to/strict.pm/directory
option (see perlfaq8
: How do I add a directory to my include path (@INC) at runtime?).
如果您发现更多不满意的依赖项,请继续向 PERL5LIB
添加目录或使用其他 -I
选项,直到您的程序可以运行.
If you find more unsatisfied dependencies, keep adding directories to PERL5LIB
or with additional -I
options until your program can run.
(尽管最终您可能会对此感到厌烦并修复/重新安装 perl.)
(Though eventually you will probably get tired of this and fix/reinstall perl.)
更新:查看 1.7.3 XAMPP 发行版,所有 perl 库文件都位于 xampp\perl\lib
和 xampp\perl\site\lib
,所以
UPDATE: Looking through the 1.7.3 XAMPP distribution, all of the perl library files are located under xampp\perl\lib
and xampp\perl\site\lib
, so
perl -IG:/xampp/perl/lib -IG:/xampp/perl/site/lib mysqldumpslow.pl -s c -t 10
可能就是您需要做的全部.如果您使用的是较旧的 XAMPP 发行版,那就太好了.
is probably all that you need to do. YMMV if you have an older XAMPP distribution.
这篇关于为什么 mysqldumpslow.pl 在 Windows 上找不到任何 Perl 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!