Description:
Patch mysql_explain_log to accept --socket option
How to repeat:
NA
Suggested fix:
===== mysql_explain_log.sh 1.2 vs edited =====
--- 1.2/scripts/mysql_explain_log.sh Tue Sep 17 22:46:51 2002
+++ edited/mysql_explain_log.sh Thu Jun 5 14:51:40 2003
@@ -14,12 +14,14 @@
$Param->{user}='';
$Param->{password}='';
$Param->{PrintError}=0;
+$Param->{socket}='';
if (!GetOptions ('date|d:i' => \$Param->{ViewDate},
'host|h:s' => \$Param->{host},
'user|u:s' => \$Param->{user},
'password|p:s' => \$Param->{password},
'printerror|e:s' => \$Param->{PrintError},
+ 'socket|s:s' => \$Param->{socket},
)) {
ShowOptions();
}
@@ -50,7 +52,7 @@
#print "Date=$Param->{ViewDate}, host=$Param->{host}, user=$Param->{user}, password=$Param->{password}\n";
- $Param->{dbh}=DBI->connect("DBI:mysql:host=$Param->{host}",$Param->{user},$Param->{password},{PrintError=>0});
+ $Param->{dbh}=DBI->connect("DBI:mysql:host=$Param->{host}".($Param->{socket}?";mysql_socket=$Param->{socket}":""),$Param->{user},$Param->{password},{PrintError=>0});
if (DBI::err()) {
print "Error: " . DBI::errstr() . "\n";
}
@@ -313,6 +315,8 @@
-u=USERNAME
--password=PASSWORD password of db-user
-p=PASSWORD
+--socket=/path/to/socket change path to the socket
+-s=/path/to/socket
Read logfile from STDIN an try to EXPLAIN all SELECT statements. All UPDATE statements are rewritten to an EXPLAIN SELECT statement. The results of the EXPLAIN statement are collected and counted. All results with type=ALL are collected in an separete list. Results are printed to STDOUT.
@@ -344,7 +348,7 @@
=head1 USAGE
-explain_log.pl [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] < logfile
+explain_log.pl [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] [--socket=/path/to/socket] < logfile
--date=YYMMDD select only entrys of date
@@ -361,6 +365,10 @@
--password=PASSWORD password of db-user
-p=PASSWORD
+
+--socket=/path/to/socket change path to the socket
+
+-s=/path/to/socket
=head1 EXAMPLE