MySQL Utilities

2.2.1.3 Command-line Options

The least secure way to provide connection information for MySQL servers is to specify the data on the command-line. This is least secure because the data is visible on the command-line and is also visible in any log or redirection of the execution.

In this case, we specify the data in the following order: user[:passwd]@host[:port][:socket] where the passwd, port, and socket are optional. Each item is described in more detail below.

The following demonstrates executing a utility using command-line options for connecting to a server.

shell> mysqlserverinfo.py --server=root:other-pass@localhost:3308 --format=vertical
# Source on localhost: ... connected.
*************************       1. row *************************
server: localhost:13001
config_file: /etc/my.cnf, /etc/mysql/my.cnf
binary_log: clone-bin.000001
binary_log_pos: 341
relay_log:
relay_log_pos:
version: 5.6.17-log
datadir: /Volumes/Source/source/temp_13001/
basedir: /Volumes/Source/source/git/mysql-5.6
plugin_dir: /Volumes/Source/source/git/mysql-5.6/lib/plugin/
general_log: OFF
general_log_file:
general_log_file_size:
log_error:
log_error_file_size:
slow_query_log: OFF
slow_query_log_file:
slow_query_log_file_size:
1 row.
#...done.

As of MySQL Utilities 1.4.4, this deprecated connection method issues a warning if you use this connection method.