This file is indexed.

/usr/bin/mysqlserverinfo is in mysql-utilities 1.3.5-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#! /usr/bin/python
#
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#

"""
This file contains the server information utility.
"""
from mysql.utilities.common.tools import check_python_version

# Check Python version compatibility
check_python_version()

import os
import sys

from mysql.utilities.command.serverinfo import show_server_info
from mysql.utilities.common.options import add_basedir_option
from mysql.utilities.common.options import check_basedir_option
from mysql.utilities.common.options import setup_common_options
from mysql.utilities.common.options import add_format_option
from mysql.utilities.common.options import add_verbosity
from mysql.utilities.common.tools import check_connector_python

from mysql.utilities.exception import UtilError

# Constants
NAME = "MySQL Utilities - mysqlserverinfo "
DESCRIPTION = "mysqlserverinfo - show server information"
USAGE = "%prog --server=user:pass@host:port:socket --format=grid"

# Check for connector/python
if not check_connector_python():
    sys.exit(1)

# Setup the command parser and setup server, help
parser = setup_common_options(os.path.basename(sys.argv[0]),
                              DESCRIPTION, USAGE, True)

# Setup utility-specific options:

# Input format
add_format_option(parser, "display the output in either grid (default), "
                  "tab, csv, or vertical format", "grid")

# Header row
parser.add_option("-h", "--no-headers", action="store_true", dest="no_headers",
                  default=False, help="do not show column headers")

# Show my.cnf values
parser.add_option("-d", "--show-defaults", action="store_true",
                  dest="show_defaults", default=False,
                  help="show defaults from the config file per server")

# Add --start option
parser.add_option("-s", "--start", action="store_true", dest="start",
                  help="start server in read only mode if offline")

# Add --basedir option
add_basedir_option(parser)

# Add --datadir option
parser.add_option("--datadir", action="store", dest="datadir", default=None,
                  type="string", help="the data directory for the server")

# Add --search-port
parser.add_option("--port-range", action="store", dest="ports",
                  default="3306:3333",
                  type="string", help="the port range to search for running"
                  " mysql servers on Windows systems")

# Add --show-servers option
parser.add_option("--show-servers", action="store_true", dest="show_servers",
                  help="show any known MySQL servers running on this host")

# Add startup timeout
parser.add_option("--start-timeout", action="store", dest="start_timeout",
                  type=int, default=10, help="Number of seconds to wait for "
                  "the server to start. Default = 10.")

# Add verbosity mode
add_verbosity(parser, False)

# Now we process the rest of the arguments.
opt, args = parser.parse_args()

# Check the basedir option for errors (e.g., invalid path)
check_basedir_option(parser, opt.basedir)

# Check start timeout for minimal value
if int(opt.start_timeout) < 10:
    opt.start_timeout = 10
    print("# WARNING: --start-timeout must be >= 10 seconds. Using "
          "default value 10.")

# Check port range
if os.name == 'nt':
    parts = opt.ports.split(":")
    if len(parts) != 2:
        print("# WARNING : {0} is not a valid port range. "
              "Using default." .format(opt.ports))
        opt.ports = "3306:3333"

# Set options for database operations.
options = {
    "format"        : opt.format,
    "no_headers"    : opt.no_headers,
    "verbosity"     : opt.verbosity,
    "debug"         : opt.verbosity >= 3,
    "show_defaults" : opt.show_defaults,
    "start"         : opt.start,
    "basedir"       : opt.basedir,
    "datadir"       : opt.datadir,
    "ports"         : opt.ports,
    "show_servers"  : opt.show_servers,
    "start_timeout" : opt.start_timeout,
}

if opt.server is None:
    parser.error("You must specify at least one server.")

try:
    show_server_info(opt.server, options)
except UtilError:
    _, e, _ = sys.exc_info()
    print("ERROR: %s" % e.errmsg)
    sys.exit(1)
except Exception:
    _, e, _ = sys.exc_info()
    print("ERROR: %s" % e)
    sys.exit(1)

print("#...done.")

sys.exit()