11# !/usr/bin/env perl
2- # mysqltuner.pl - Version 2.8.36
2+ # mysqltuner.pl - Version 2.8.37
33# High Performance MySQL Tuning Script
44# Copyright (C) 2015-2026 Jean-Marie Renouard - jmrenouard@gmail.com
55# Copyright (C) 2006-2026 Major Hayden - major@mhtx.net
@@ -47,6 +47,7 @@ package main;
4747use File::Spec;
4848use Getopt::Long;
4949use Pod::Usage;
50+ use Sys::Hostname;
5051use File::Basename;
5152use Cwd ' abs_path' ;
5253
@@ -64,7 +65,7 @@ package main;
6465our $is_win = $^O eq ' MSWin32' ;
6566
6667# Set up a few variables for use in the script
67- our $tunerversion = " 2.8.36 " ;
68+ our $tunerversion = " 2.8.37 " ;
6869our ( @adjvars , @generalrec , @modeling , @sysrec , @secrec );
6970
7071# Set defaults
@@ -700,8 +701,7 @@ sub setup_environment {
700701 $opt {nocolor } = 0 if ( ( $opt {color } // 0 ) == 1 );
701702
702703 # Setting up the colors for the print styles
703- $me = execute_system_command(' whoami' );
704- $me =~ s /\n // g ;
704+ $me = ( getpwuid ($< ) )[0] // $ENV {USER } // $ENV {USERNAME } // ' unknown' ;
705705
706706 if ($is_win ) { $opt {nocolor } = 1; }
707707 $good = ( $opt {nocolor } == 0 ) ? " [\e [0;32mOK\e [0m]" : " [OK]" ;
@@ -1889,7 +1889,7 @@ sub mysql_setup {
18891889 my $userpath =
18901890 $is_win
18911891 ? ( $ENV {MARIADB_HOME } || $ENV {MYSQL_HOME } || $ENV {USERPROFILE } )
1892- : execute_system_command( " printenv HOME" );
1892+ : ( $ENV { HOME } // ' ' );
18931893 if ( length ($userpath ) > 0 ) {
18941894 chomp ($userpath );
18951895 }
@@ -1954,7 +1954,7 @@ sub mysql_setup {
19541954 ? ( $ENV {MARIADB_HOME }
19551955 || $ENV {MYSQL_HOME }
19561956 || $ENV {USERPROFILE } )
1957- : execute_system_command( " printenv HOME" );
1957+ : ( $ENV { HOME } // ' ' );
19581958 chomp ($userpath );
19591959 unless ( -e " $userpath /.my.cnf" ) {
19601960 print STDERR " " ;
@@ -3131,14 +3131,14 @@ sub get_system_info {
31313131 ? execute_system_command(' ver' )
31323132 : execute_system_command(' uname -r' );
31333133 infoprint " Kernel Release : " . infocmd_one " uname -r" ;
3134- $result {' OS' }{' Hostname' } = execute_system_command( ' hostname' );
3134+ $result {' OS' }{' Hostname' } = Sys::Hostname:: hostname( );
31353135 $result {' Network' }{' Internal Ip' } =
31363136 $is_win
31373137 ? execute_system_command(
31383138' ipconfig |perl -ne "if (/IPv. Address/) {print s/^.*?([\\ d\\ .]*)\\ s*$/$1/r; exit; }"'
31393139 )
31403140 : execute_system_command(' hostname -I' );
3141- infoprint " Hostname : " . infocmd_one " hostname" ;
3141+ infoprint " Hostname : " . Sys::Hostname:: hostname() ;
31423142 infoprint " Network Cards : " ;
31433143
31443144 if ( which( " ip" , $ENV {' PATH' } ) ) {
@@ -9789,7 +9789,7 @@ sub dump_csv_files {
97899789
97909790=head1 NAME
97919791
9792- MySQLTuner 2.8.36 - MySQL High Performance Tuning Script
9792+ MySQLTuner 2.8.37 - MySQL High Performance Tuning Script
97939793
97949794=head1 IMPORTANT USAGE GUIDELINES
97959795
@@ -9804,7 +9804,7 @@ =head1 OPTIONS
98049804
98059805=head1 VERSION
98069806
9807- Version 2.8.36
9807+ Version 2.8.37
98089808=head1 PERLDOC
98099809
98109810You can find documentation for this module with the perldoc command.
0 commit comments