时间:2021-07-01 10:21:17 帮助过:32人阅读
二、安装需求及下载地址
需求
Python 2.6
MySQL Connector/Python 连接器
下载地址:
http://dev.mysql.com/downloads/utilities/
三、安装示例
- ###本次安装使用1.<span style="color: #800080;">6</span><span style="color: #000000;">.4版本,安装前,需要先安装mysql到python连接器
- # </span><span style="color: #0000ff;">cat</span> /etc/redhat-<span style="color: #000000;">release
- CentOS release </span><span style="color: #800080;">6.7</span><span style="color: #000000;"> (Final)
- # rpm </span>-Uvh mysql-connector-python-<span style="color: #800080;">2.1</span>.<span style="color: #800080;">4</span>-<span style="color: #800080;">1</span><span style="color: #000000;">.el6.x86_64.rpm
- # rpm </span>-Uvh mysql-utilities-<span style="color: #800080;">1.6</span>.<span style="color: #800080;">4</span>-<span style="color: #800080;">1</span><span style="color: #000000;">.el6.noarch.rpm
- ###如果没有安装连接器,则收到如下错误提示
- # rpm </span>-Uvh mysql-utilities-<span style="color: #800080;">1.6</span>.<span style="color: #800080;">4</span>-<span style="color: #800080;">1</span><span style="color: #000000;">.el6.noarch.rpm
- warning: mysql</span>-utilities-<span style="color: #800080;">1.6</span>.<span style="color: #800080;">4</span>-<span style="color: #800080;">1</span>.el6.noarch.rpm: Header V3 DSA/<span style="color: #000000;">SHA1 Signature, key ID 5072e1f5: NOKEY
- error: Failed dependencies:
- mysql</span>-connector-python >= <span style="color: #800080;">2.0</span>.<span style="color: #800080;">0</span> is needed by mysql-utilities-<span style="color: #800080;">1.6</span>.<span style="color: #800080;">4</span>-<span style="color: #800080;">1</span><span style="color: #000000;">.el6.noarch
- ###查看安装后生成的文件
- # rpm </span>-ql mysql-utilities-<span style="color: #800080;">1.6</span>.<span style="color: #800080;">4</span>-<span style="color: #800080;">1</span>.el6|<span style="color: #0000ff;">grep</span> <span style="color: #800000;">"</span><span style="color: #800000;">/usr/bin</span><span style="color: #800000;">"</span>
- /usr/bin/<span style="color: #000000;">mysqlauditadmin
- </span>/usr/bin/<span style="color: #000000;">mysqlauditgrep
- </span>/usr/bin/<span style="color: #000000;">mysqlbinlogmove
- </span>/usr/bin/<span style="color: #000000;">mysqlbinlogpurge
- </span>/usr/bin/<span style="color: #000000;">mysqlbinlogrotate
- </span>/usr/bin/<span style="color: #000000;">mysqldbcompare
- </span>/usr/bin/<span style="color: #000000;">mysqldbcopy
- </span>/usr/bin/<span style="color: #000000;">mysqldbexport
- </span>/usr/bin/<span style="color: #000000;">mysqldbimport
- </span>/usr/bin/<span style="color: #000000;">mysqldiff
- </span>/usr/bin/<span style="color: #000000;">mysqldiskusage
- </span>/usr/bin/<span style="color: #000000;">mysqlfailover
- </span>/usr/bin/<span style="color: #000000;">mysqlfrm
- </span>/usr/bin/<span style="color: #000000;">mysqlgrants
- </span>/usr/bin/<span style="color: #000000;">mysqlindexcheck
- </span>/usr/bin/<span style="color: #000000;">mysqlmetagrep
- </span>/usr/bin/<span style="color: #000000;">mysqlprocgrep
- </span>/usr/bin/<span style="color: #000000;">mysqlreplicate
- </span>/usr/bin/<span style="color: #000000;">mysqlrpladmin
- </span>/usr/bin/<span style="color: #000000;">mysqlrplcheck
- </span>/usr/bin/<span style="color: #000000;">mysqlrplms
- </span>/usr/bin/<span style="color: #000000;">mysqlrplshow
- </span>/usr/bin/<span style="color: #000000;">mysqlrplsync
- </span>/usr/bin/<span style="color: #000000;">mysqlserverclone
- </span>/usr/bin/<span style="color: #000000;">mysqlserverinfo
- </span>/usr/bin/<span style="color: #000000;">mysqlslavetrx
- </span>/usr/bin/<span style="color: #000000;">mysqluc
- </span>/usr/bin/mysqluserclone
四、获取帮助
- <span style="color: #800080;">1</span><span style="color: #000000;">、通过mysqluc获取帮助
- ###可以通过调用mysqluc命令行工具来获取这些工具的帮助信息
- ### mysqluc提供一个自带的命令行提示符窗口,在这个窗口下也可以完成相应的命令操作
- [root@node1 </span>~<span style="color: #000000;">]# mysqluc
- Launching console ...
- Welcome to the MySQL Utilities Client (mysqluc) version </span><span style="color: #800080;">1.6</span>.<span style="color: #800080;">4</span><span style="color: #000000;">
- Copyright (c) </span><span style="color: #800080;">2010</span>, <span style="color: #800080;">2016</span> Oracle and/<span style="color: #000000;">or its affiliates. All rights reserved.
- This is a release of dual licensed MySQL Utilities. For the avoidance of
- doubt, this particular copy of the software is released
- under the version </span><span style="color: #800080;">2</span><span style="color: #000000;"> of the GNU General Public License.
- MySQL Utilities is brought to you by Oracle.
- Type </span><span style="color: #800000;">‘</span><span style="color: #800000;">help</span><span style="color: #800000;">‘</span> <span style="color: #0000ff;">for</span> a list of commands or press TAB twice <span style="color: #0000ff;">for</span><span style="color: #000000;"> list of utilities.
- mysqluc</span>><span style="color: #000000;"> help
- Command Description
- </span>---------------------- ---------------------------------------------------<span style="color: #000000;">
- help utilities Display list of all utilities supported.
- help </span><utility> Display help <span style="color: #0000ff;">for</span><span style="color: #000000;"> a specific utility.
- show errors Display errors captured during the execution of the
- utilities.
- </span><span style="color: #0000ff;">clear</span> errors <span style="color: #0000ff;">clear</span><span style="color: #000000;"> captured errors.
- show </span><span style="color: #0000ff;">last</span> error Display the <span style="color: #0000ff;">last</span><span style="color: #000000;"> error captured during the
- execution of the utilities
- help </span>|<span style="color: #000000;"> help commands Show this list.
- exit </span>|<span style="color: #000000;"> quit Exit the console.
- set </span><variable>=<value> Store a variable <span style="color: #0000ff;">for</span> recall <span style="color: #0000ff;">in</span><span style="color: #000000;"> commands.
- show options Display list of options specified by the user on
- launch.
- show variables Display list of variables.
- </span><ENTER><span style="color: #000000;"> Press ENTER to execute command.
- </span><ESCAPE> Press ESCAPE to <span style="color: #0000ff;">clear</span><span style="color: #000000;"> the command entry.
- </span><DOWN><span style="color: #000000;"> Press DOWN to retrieve the previous command.
- </span><UP> Press UP to retrieve the next command <span style="color: #0000ff;">in</span><span style="color: #000000;"> history.
- </span><TAB> Press TAB <span style="color: #0000ff;">for</span><span style="color: #000000;"> type completion of utility, option,
- or variable names.
- </span><TAB><TAB> Press TAB twice <span style="color: #0000ff;">for</span><span style="color: #000000;"> list of matching type
- completion (context sensitive).
- ###查看utilities包中所有的命令行工具
- mysqluc</span>><span style="color: #000000;"> help utilities
- Utility Description
- </span>----------------- --------------------------------------------------------<span style="color: #000000;">
- mysqlauditadmin audit log maintenance utility
- mysqlauditgrep audit log search utility
- mysqlbinlogmove binary log relocate utility
- mysqlbinlogpurge purges unnecessary binary log files
- mysqlbinlogrotate rotates the active binary log </span><span style="color: #0000ff;">file</span><span style="color: #000000;">
- mysqldbcompare compare databases </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> consistency
- mysqldbcopy copy databases from one server to another
- mysqldbexport export metadata and data from databases
- mysqldbimport import metadata and data from files
- mysqldiff compare </span><span style="color: #0000ff;">object</span><span style="color: #000000;"> definitions among objects where the
- difference is how db1.obj1 differs from db2.obj2
- mysqldiskusage show disk usage </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> databases
- mysqlfailover automatic replication health monitoring and failover
- mysqlfrm show CREATE TABLE from .frm files
- mysqlgrants display grants per </span><span style="color: #0000ff;">object</span><span style="color: #000000;">
- mysqlindexcheck check </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> duplicate or redundant indexes
- mysqlmetagrep search metadata
- mysqlprocgrep search process information
- mysqlreplicate establish replication with a master
- mysqlrpladmin administration utility </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> MySQL replication
- mysqlrplcheck check replication
- mysqlrplms establish multi</span>-<span style="color: #000000;">source replication
- mysqlrplshow show slaves attached to a master
- mysqlrplsync replication synchronization checker utility
- mysqlserverclone start another instance of a running server
- mysqlserverinfo show server information
- mysqlslavetrx skip transactions on slaves
- mysqluserclone clone a MySQL user account to one or </span><span style="color: #0000ff;">more</span><span style="color: #000000;"> new users
- ###也可直接在mysqluc提示符下输入 help command 来获取对应命令的帮助信息,如下
- mysqluc</span>><span style="color: #000000;"> help mysqlauditadmin
- Usage: mysqlauditadmin </span>--server=user:pass@host:port --show-<span style="color: #000000;">options
- # Author : Leshami
- # Blog : http:</span><span style="color: #008000;">//</span><span style="color: #008000;">blog.csdn.net/leshami</span>
- mysqlauditadmin -<span style="color: #000000;"> audit log maintenance utility
- Options:
- Option Description
- </span>------------------------- ------------------------------------------------
- --version show program<span style="color: #800000;">‘</span><span style="color: #800000;">s version number and exit </span>
- --<span style="color: #000000;">help display this help message and exit
- </span>--license display program<span style="color: #800000;">‘</span><span style="color: #800000;">s license and exit </span>
- --server=SERVER connection information <span style="color: #0000ff;">for</span> the server <span style="color: #0000ff;">in</span><span style="color: #000000;"> the
- form:
- </span><user>[:<password>]@<host>[:<port>][:<socket><span style="color: #000000;">]
- or </span><<span style="color: #0000ff;">login</span>-path>[:<port>][:<socket>] or <config-<span style="color: #000000;">
- path</span>>[<[group]><span style="color: #000000;">].
- </span>--audit-log-name=LOG_NAME full path and <span style="color: #0000ff;">file</span> name <span style="color: #0000ff;">for</span> the audit log <span style="color: #0000ff;">file</span><span style="color: #000000;">.
- Used </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> stats and copy options.
- </span>--show-<span style="color: #000000;">options display the audit log system variables.
- </span>--remote-<span style="color: #0000ff;">login</span>=RLOGIN user name and host to be used <span style="color: #0000ff;">for</span> remote <span style="color: #0000ff;">login</span>
- <span style="color: #0000ff;">for</span><span style="color: #000000;"> copying log files. Format:
- </span><user>:<host_or_ip><span style="color: #000000;"> Password will be prompted.
- </span>--<span style="color: #0000ff;">file</span>-stats display the audit log <span style="color: #0000ff;">file</span><span style="color: #000000;"> statistics.
- </span>--copy-to=COPY_LOCATION the location to copy the audit log <span style="color: #0000ff;">file</span><span style="color: #000000;">
- specified. The path must be locally accessible
- </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> the current user.
- </span>--value=<span style="color: #000000;">VALUE value used to set variables based on the command
- specified. See </span>--help <span style="color: #0000ff;">for</span><span style="color: #000000;"> list per command.
- </span>--ssl-ca=SSL_CA path to a <span style="color: #0000ff;">file</span><span style="color: #000000;"> that contains a list of trusted
- SSL CAs.
- </span>--ssl-cert=SSL_CERT name of the SSL certificate <span style="color: #0000ff;">file</span> to use <span style="color: #0000ff;">for</span><span style="color: #000000;">
- establishing a secure connection.
- </span>--ssl-key=SSL_KEY name of the SSL key <span style="color: #0000ff;">file</span> to use <span style="color: #0000ff;">for</span><span style="color: #000000;"> establishing
- a secure connection.
- </span>--ssl=SSL specifies <span style="color: #0000ff;">if</span><span style="color: #000000;"> the server connection requires use
- of SSL. If an encrypted connection cannot be
- established, the connection attempt fails. By
- default </span><span style="color: #800080;">0</span><span style="color: #000000;"> (SSL not required).
- </span>-v, --<span style="color: #000000;">verbose control how much information is displayed. e.g.,
- </span>-v = verbose, -vv = <span style="color: #0000ff;">more</span> verbose, -vvv =<span style="color: #000000;"> debug
- Available Commands: copy </span>-<span style="color: #000000;"> copy the audit log to
- a locally accessible path policy </span>-<span style="color: #000000;"> set the audit
- log policy Values </span>=<span style="color: #000000;"> ALL, NONE, LOGINS, QUERIES,
- DEFAULT rotate </span>-<span style="color: #000000;"> perform audit log rotation
- rotate_on_size </span>-<span style="color: #000000;"> set the rotate log size limit
- </span><span style="color: #0000ff;">for</span> auto rotation Values = <span style="color: #800080;">0</span>, <span style="color: #800080;">4294967295</span>
2、直接在shell提示符下获取命令帮助
- <span style="color: #000000;">###如下示例
- [root@node1 </span>~]# mysqlfailover --help|<span style="color: #0000ff;">head</span><span style="color: #000000;">
- MySQL Utilities mysqlfailover version </span><span style="color: #800080;">1.6</span>.<span style="color: #800080;">4</span><span style="color: #000000;">
- License type: GPLv2
- Usage: mysqlfailover </span>--master=root@localhost --discover-slaves-<span style="color: #0000ff;">login</span>=<span style="color: #000000;">root
- </span>--candidates=root@host123:<span style="color: #800080;">3306</span>,root@host456:<span style="color: #800080;">3306</span><span style="color: #000000;">
- mysqlfailover </span>-<span style="color: #000000;"> automatic replication health monitoring and failover
- Options:
- </span>--version show program<span style="color: #800000;">‘</span><span style="color: #800000;">s version number and exit</span>
- --<span style="color: #000000;">help display this help message and exit
- </span>--license display program<span style="color: #800000;">‘</span><span style="color: #800000;">s license and exit</span>
3、基于Linux man获取命令帮助
- <span style="color: #000000;">###如下示例
- root@node1 </span>~]# <span style="color: #0000ff;">man</span><span style="color: #000000;"> mysqlfailover
- MYSQLFAILOVER(</span><span style="color: #800080;">1</span>) MySQL Utilities MYSQLFAILOVER(<span style="color: #800080;">1</span><span style="color: #000000;">)
- NAME
- mysqlfailover </span>-<span style="color: #000000;"> Automatic replication master failover
- SYNOPSIS
- mysqlfailover [options]</span>
【转】MySQL-Utilities,mysql工具包
标签:usr metadata option create main moni final cap 安装mysql