-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using --defaults-file ignores the .my.cnf #605
- Loading branch information
Jean-Marie RENOUARD
committed
Sep 13, 2022
1 parent
2259dfc
commit fdd42e7
Showing
1 changed file
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/env perl | ||
# mysqltuner.pl - Version 2.0.6 | ||
# mysqltuner.pl - Version 2.0.7 | ||
# High Performance MySQL Tuning Script | ||
# Copyright (C) 2006-2022 Major Hayden - [email protected] | ||
# Copyright (C) 2015-2022 Jean-Marie Renouard - [email protected] | ||
|
@@ -57,7 +57,7 @@ package main; | |
#use Env; | ||
|
||
# Set up a few variables for use in the script | ||
my $tunerversion = "2.0.6"; | ||
my $tunerversion = "2.0.7"; | ||
my ( @adjvars, @generalrec ); | ||
|
||
# Set defaults | ||
|
@@ -108,6 +108,7 @@ package main; | |
"reportfile" => 0, | ||
"verbose" => 0, | ||
"defaults-file" => '', | ||
"defaults-extra-file" => '', | ||
"protocol" => '', | ||
); | ||
|
||
|
@@ -140,6 +141,7 @@ package main; | |
'pfstat', 'nopfstat', | ||
'idxstat', 'noidxstat', | ||
'server-log=s', 'protocol=s', | ||
'defaults-extra-file=s', | ||
) | ||
or pod2usage( | ||
-exitval => 1, | ||
|
@@ -915,6 +917,20 @@ sub mysql_setup { | |
return 1; | ||
} | ||
} | ||
elsif ( $opt{'defaults-extra-file'} ne '' and -r "$opt{'defaults-extra-file'}" ) { | ||
|
||
# defaults-extra-file | ||
debugprint "defaults extra file detected: $opt{'defaults-extra-file'}"; | ||
my $mysqlclidefaults = `$mysqlcmd --print-defaults`; | ||
debugprint "MySQL Client Extra Default File: $opt{'defaults-extra-file'}"; | ||
|
||
$mysqllogin = "--defaults-extra-file=" . $opt{'defaults-extra-file'}; | ||
my $loginstatus = `$mysqladmincmd $mysqllogin ping 2>&1`; | ||
if ( $loginstatus =~ /mysqld is alive/ ) { | ||
goodprint "Logged in using credentials from extra defaults file account."; | ||
return 1; | ||
} | ||
} | ||
else { | ||
# It's not Plesk or Debian, we should try a login | ||
debugprint "$mysqladmincmd $remotestring ping 2>&1"; | ||
|
@@ -6905,7 +6921,7 @@ sub which { | |
=head1 NAME | ||
MySQLTuner 2.0.6 - MySQL High Performance Tuning Script | ||
MySQLTuner 2.0.7 - MySQL High Performance Tuning Script | ||
=head1 IMPORTANT USAGE GUIDELINES | ||
|
@@ -6928,6 +6944,7 @@ =head1 CONNECTION AND AUTHENTICATION | |
--mysqladmin <path> Path to a custom mysqladmin executable | ||
--mysqlcmd <path> Path to a custom mysql executable | ||
--defaults-file <path> Path to a custom .my.cnf | ||
--defaults-extra-file <path> Path to a extra custom config file | ||
--server-log <path> Path to explicit log file (error_log) | ||
=head1 PERFORMANCE AND REPORTING OPTIONS | ||
|