June 26, 2019

mysqlprocgrep utility commands in MySQL

MySQL utility mysqlprocgrep cheatsheet


mysqlprocgrep     search or grep for process information/list            
mysqlprocgrep --version
mysqlprocgrep --help
Usage: mysqlprocgrep --server=user:pass@host:port:socket [options]

mysqlprocgrep utility scans the process lists for servers specified using instances of the --server option and selects those that match the conditions specified.

mysqlprocgrep --server=root:secret@localhost
mysqlprocgrep --server=root@localhost --match-user=procgrep --age=1m --kill-query
mysqlprocgrep --server=dba --match-command=sleep --age=1h --kill
mysqlprocgrep --kill-connection --sql-body --match-user=data --match-state=sleep

mysqlprocgrep --server=root@localhost --match-user=satya --kill-connection --format=CSV
mysqlprocgrep --server=root@localhost --match-command=sleep --age=1h --kill-connection --verbose
mysqlprocgrep --server=mysql_dba --match-db=sakila --kill-connection --format=TAB -v

mysqlprocgrep Options:
  --version                 show program's version number and exit
  --help                     display a help message and exit
  --license                 display program's license and exit
  --server=SERVER    connection information for the server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config- path[[group]].

  --ssl-ca=SSL_CA        path to a file that contains a list of trusted SSL CAs.
  --ssl-cert=SSL_CERT  name of the SSL certificate file to use for   establishing a secure connection.
  --ssl-key=SSL_KEY    name of the SSL key file to use for establishing a  secure connection.
  --ssl=SSL                  specifies if the server connection requires use of SSL. If an encrypted connection cannot be established, the connection attempt fails. By default 0 (SSL not required).

  --character-set=CHARSET    sets the client character set. The default is retrieved from the server variable 'character_set_client'.
  -G, --basic-regexp, --regexp    use 'REGEXP' operator to match pattern. Default is to use 'LIKE'.
  -Q, --print-sql, --sql     print the statement instead of sending it to the server. If a kill option is submitted, a procedure will be generated containing the code for executing the kill.
  --sql-body                   only print the body of the procedure.

  --kill-connection     kill all matching connections.
  --kill-query            kill query for all matching processes.
  --print                   print all matching processes.
  -f FORMAT, --format=FORMAT   display the output in either grid (default), tab, csv, or vertical format
  -v, --verbose         control how much information is displayed. e.g., -v =  verbose, -vv = more verbose, -vvv = debug

  --match-id=PATTERN      match the 'ID' column of the PROCESSLIST table.
  --match-user=PATTERN  match the 'USER' column of the PROCESSLIST table.
  --match-host=PATTERN  match the 'HOST' column of the PROCESSLIST table.
  --match-db=PATTERN     match the 'DB' column of the PROCESSLIST table.
  --match-command=PATTERN  match the 'COMMAND' column of the PROCESSLIST table.
  --match-info=PATTERN     match the 'INFO' column of the PROCESSLIST table.
  --match-state=PATTERN   match the 'STATE' column of the PROCESSLIST table.
  --age=AGE                      show only processes that have been in the current  state more than a given time.


Related MySQL Articles: mysqlrplms utility in MySQL

No comments:

Post a Comment