I've set up a log file to pick up MySQL slow queries.
I've been unable to parse the file however. Linux makes this task seem very simple. In tutorials it seems as easy as:
$ mysqldumpslow -s c -t 10
In Windows however, I'm not sure how you run Perl, located in: G:\xampp\perl\bin with the Perl Script mysqldumpslow.pl, located in: G:\xampp\mysql\scripts
I've tried to enter:
G:\xampp\mysql\scripts\perl mysqldumpslow -s c -t 10
The command prompt returns something like "perl is not recognized".
Errm, you are using the wrong paths.
If perl.exe is located in G:\xampp\perl\bin and the mysql script in G:\xampp\mysql\scripts, you need:
> G:\xampp\perl\bin\perl G:\xampp\mysql\scripts\mysqldumpslow.pl -s c -t 10.
Of course, that's a very roundabout way of doing things, so instead, add perl to your PATH, and cd
into the correct directory and then run it:
> set PATH=G:\xampp\perl\bin\;%PATH% // Note: This can be added in the
// System Control Panel.
> cd /d G:\xampp\mysql\scripts
> perl mysqldumpslow.pl -s c -t 10
Or even better, add perl to your known filetypes.
pl
for the
extension field. Click Ok.For Action type open
, for 'Application used to perform action' type:
G:\xampp\perl\bin\perl.exe -w "%1" %*
Click Ok.
Now you can just run the script as:
> mysqldumpslow.pl -s c -t 10
As you would in Linux.
Quick note: Adding .pl files as known file types is roughly equivalent to Unix people adding
#!/usr/bin/perl -w
to the start of every perl script. In Windows you only need to add it once.
Second note: The -w
turns on Warnings in the perl interpreter. You can leave out the -w
if you wish.
I fixed this error by using the command:
set PATH=C:\perl\bin;%PATH%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With