当前位置:Gxlcms > 数据库问题 > 【转】MySQL-Utilities,mysql工具包

【转】MySQL-Utilities,mysql工具包

时间:2021-07-01 10:21:17 帮助过:32人阅读

 

二、安装需求及下载地址


需求
  Python 2.6
  MySQL Connector/Python 连接器
下载地址:
  http://dev.mysql.com/downloads/utilities/

三、安装示例

  1. ###本次安装使用1.<span style="color: #800080;">6</span><span style="color: #000000;">.4版本,安装前,需要先安装mysql到python连接器
  2. # </span><span style="color: #0000ff;">cat</span> /etc/redhat-<span style="color: #000000;">release
  3. CentOS release </span><span style="color: #800080;">6.7</span><span style="color: #000000;"> (Final)
  4. # 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
  5. # 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
  6. ###如果没有安装连接器,则收到如下错误提示
  7. # 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
  8. 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
  9. error: Failed dependencies:
  10. 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
  11. ###查看安装后生成的文件
  12. # 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>
  13. /usr/bin/<span style="color: #000000;">mysqlauditadmin
  14. </span>/usr/bin/<span style="color: #000000;">mysqlauditgrep
  15. </span>/usr/bin/<span style="color: #000000;">mysqlbinlogmove
  16. </span>/usr/bin/<span style="color: #000000;">mysqlbinlogpurge
  17. </span>/usr/bin/<span style="color: #000000;">mysqlbinlogrotate
  18. </span>/usr/bin/<span style="color: #000000;">mysqldbcompare
  19. </span>/usr/bin/<span style="color: #000000;">mysqldbcopy
  20. </span>/usr/bin/<span style="color: #000000;">mysqldbexport
  21. </span>/usr/bin/<span style="color: #000000;">mysqldbimport
  22. </span>/usr/bin/<span style="color: #000000;">mysqldiff
  23. </span>/usr/bin/<span style="color: #000000;">mysqldiskusage
  24. </span>/usr/bin/<span style="color: #000000;">mysqlfailover
  25. </span>/usr/bin/<span style="color: #000000;">mysqlfrm
  26. </span>/usr/bin/<span style="color: #000000;">mysqlgrants
  27. </span>/usr/bin/<span style="color: #000000;">mysqlindexcheck
  28. </span>/usr/bin/<span style="color: #000000;">mysqlmetagrep
  29. </span>/usr/bin/<span style="color: #000000;">mysqlprocgrep
  30. </span>/usr/bin/<span style="color: #000000;">mysqlreplicate
  31. </span>/usr/bin/<span style="color: #000000;">mysqlrpladmin
  32. </span>/usr/bin/<span style="color: #000000;">mysqlrplcheck
  33. </span>/usr/bin/<span style="color: #000000;">mysqlrplms
  34. </span>/usr/bin/<span style="color: #000000;">mysqlrplshow
  35. </span>/usr/bin/<span style="color: #000000;">mysqlrplsync
  36. </span>/usr/bin/<span style="color: #000000;">mysqlserverclone
  37. </span>/usr/bin/<span style="color: #000000;">mysqlserverinfo
  38. </span>/usr/bin/<span style="color: #000000;">mysqlslavetrx
  39. </span>/usr/bin/<span style="color: #000000;">mysqluc
  40. </span>/usr/bin/mysqluserclone

 

四、获取帮助

  1. <span style="color: #800080;">1</span><span style="color: #000000;">、通过mysqluc获取帮助
  2. ###可以通过调用mysqluc命令行工具来获取这些工具的帮助信息
  3. ### mysqluc提供一个自带的命令行提示符窗口,在这个窗口下也可以完成相应的命令操作
  4. [root@node1 </span>~<span style="color: #000000;">]# mysqluc
  5. Launching console ...
  6. 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;">
  7. 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.
  8. This is a release of dual licensed MySQL Utilities. For the avoidance of
  9. doubt, this particular copy of the software is released
  10. under the version </span><span style="color: #800080;">2</span><span style="color: #000000;"> of the GNU General Public License.
  11. MySQL Utilities is brought to you by Oracle.
  12. 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.
  13. mysqluc</span>><span style="color: #000000;"> help
  14. Command Description
  15. </span>---------------------- ---------------------------------------------------<span style="color: #000000;">
  16. help utilities Display list of all utilities supported.
  17. help </span><utility> Display help <span style="color: #0000ff;">for</span><span style="color: #000000;"> a specific utility.
  18. show errors Display errors captured during the execution of the
  19. utilities.
  20. </span><span style="color: #0000ff;">clear</span> errors <span style="color: #0000ff;">clear</span><span style="color: #000000;"> captured errors.
  21. 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
  22. execution of the utilities
  23. help </span>|<span style="color: #000000;"> help commands Show this list.
  24. exit </span>|<span style="color: #000000;"> quit Exit the console.
  25. 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.
  26. show options Display list of options specified by the user on
  27. launch.
  28. show variables Display list of variables.
  29. </span><ENTER><span style="color: #000000;"> Press ENTER to execute command.
  30. </span><ESCAPE> Press ESCAPE to <span style="color: #0000ff;">clear</span><span style="color: #000000;"> the command entry.
  31. </span><DOWN><span style="color: #000000;"> Press DOWN to retrieve the previous command.
  32. </span><UP> Press UP to retrieve the next command <span style="color: #0000ff;">in</span><span style="color: #000000;"> history.
  33. </span><TAB> Press TAB <span style="color: #0000ff;">for</span><span style="color: #000000;"> type completion of utility, option,
  34. or variable names.
  35. </span><TAB><TAB> Press TAB twice <span style="color: #0000ff;">for</span><span style="color: #000000;"> list of matching type
  36. completion (context sensitive).
  37. ###查看utilities包中所有的命令行工具
  38. mysqluc</span>><span style="color: #000000;"> help utilities
  39. Utility Description
  40. </span>----------------- --------------------------------------------------------<span style="color: #000000;">
  41. mysqlauditadmin audit log maintenance utility
  42. mysqlauditgrep audit log search utility
  43. mysqlbinlogmove binary log relocate utility
  44. mysqlbinlogpurge purges unnecessary binary log files
  45. mysqlbinlogrotate rotates the active binary log </span><span style="color: #0000ff;">file</span><span style="color: #000000;">
  46. mysqldbcompare compare databases </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> consistency
  47. mysqldbcopy copy databases from one server to another
  48. mysqldbexport export metadata and data from databases
  49. mysqldbimport import metadata and data from files
  50. mysqldiff compare </span><span style="color: #0000ff;">object</span><span style="color: #000000;"> definitions among objects where the
  51. difference is how db1.obj1 differs from db2.obj2
  52. mysqldiskusage show disk usage </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> databases
  53. mysqlfailover automatic replication health monitoring and failover
  54. mysqlfrm show CREATE TABLE from .frm files
  55. mysqlgrants display grants per </span><span style="color: #0000ff;">object</span><span style="color: #000000;">
  56. mysqlindexcheck check </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> duplicate or redundant indexes
  57. mysqlmetagrep search metadata
  58. mysqlprocgrep search process information
  59. mysqlreplicate establish replication with a master
  60. mysqlrpladmin administration utility </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> MySQL replication
  61. mysqlrplcheck check replication
  62. mysqlrplms establish multi</span>-<span style="color: #000000;">source replication
  63. mysqlrplshow show slaves attached to a master
  64. mysqlrplsync replication synchronization checker utility
  65. mysqlserverclone start another instance of a running server
  66. mysqlserverinfo show server information
  67. mysqlslavetrx skip transactions on slaves
  68. mysqluserclone clone a MySQL user account to one or </span><span style="color: #0000ff;">more</span><span style="color: #000000;"> new users
  69. ###也可直接在mysqluc提示符下输入 help command 来获取对应命令的帮助信息,如下
  70. mysqluc</span>><span style="color: #000000;"> help mysqlauditadmin
  71. Usage: mysqlauditadmin </span>--server=user:pass@host:port --show-<span style="color: #000000;">options
  72. # Author : Leshami
  73. # Blog : http:</span><span style="color: #008000;">//</span><span style="color: #008000;">blog.csdn.net/leshami</span>
  74. mysqlauditadmin -<span style="color: #000000;"> audit log maintenance utility
  75. Options:
  76. Option Description
  77. </span>------------------------- ------------------------------------------------
  78. --version show program<span style="color: #800000;">‘</span><span style="color: #800000;">s version number and exit </span>
  79. --<span style="color: #000000;">help display this help message and exit
  80. </span>--license display program<span style="color: #800000;">‘</span><span style="color: #800000;">s license and exit </span>
  81. --server=SERVER connection information <span style="color: #0000ff;">for</span> the server <span style="color: #0000ff;">in</span><span style="color: #000000;"> the
  82. form:
  83. </span><user>[:<password>]@<host>[:<port>][:<socket><span style="color: #000000;">]
  84. or </span><<span style="color: #0000ff;">login</span>-path>[:<port>][:<socket>] or <config-<span style="color: #000000;">
  85. path</span>>[<[group]><span style="color: #000000;">].
  86. </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;">.
  87. Used </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> stats and copy options.
  88. </span>--show-<span style="color: #000000;">options display the audit log system variables.
  89. </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>
  90. <span style="color: #0000ff;">for</span><span style="color: #000000;"> copying log files. Format:
  91. </span><user>:<host_or_ip><span style="color: #000000;"> Password will be prompted.
  92. </span>--<span style="color: #0000ff;">file</span>-stats display the audit log <span style="color: #0000ff;">file</span><span style="color: #000000;"> statistics.
  93. </span>--copy-to=COPY_LOCATION the location to copy the audit log <span style="color: #0000ff;">file</span><span style="color: #000000;">
  94. specified. The path must be locally accessible
  95. </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> the current user.
  96. </span>--value=<span style="color: #000000;">VALUE value used to set variables based on the command
  97. specified. See </span>--help <span style="color: #0000ff;">for</span><span style="color: #000000;"> list per command.
  98. </span>--ssl-ca=SSL_CA path to a <span style="color: #0000ff;">file</span><span style="color: #000000;"> that contains a list of trusted
  99. SSL CAs.
  100. </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;">
  101. establishing a secure connection.
  102. </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
  103. a secure connection.
  104. </span>--ssl=SSL specifies <span style="color: #0000ff;">if</span><span style="color: #000000;"> the server connection requires use
  105. of SSL. If an encrypted connection cannot be
  106. established, the connection attempt fails. By
  107. default </span><span style="color: #800080;">0</span><span style="color: #000000;"> (SSL not required).
  108. </span>-v, --<span style="color: #000000;">verbose control how much information is displayed. e.g.,
  109. </span>-v = verbose, -vv = <span style="color: #0000ff;">more</span> verbose, -vvv =<span style="color: #000000;"> debug
  110. Available Commands: copy </span>-<span style="color: #000000;"> copy the audit log to
  111. a locally accessible path policy </span>-<span style="color: #000000;"> set the audit
  112. log policy Values </span>=<span style="color: #000000;"> ALL, NONE, LOGINS, QUERIES,
  113. DEFAULT rotate </span>-<span style="color: #000000;"> perform audit log rotation
  114. rotate_on_size </span>-<span style="color: #000000;"> set the rotate log size limit
  115. </span><span style="color: #0000ff;">for</span> auto rotation Values = <span style="color: #800080;">0</span>, <span style="color: #800080;">4294967295</span>

 

 

2、直接在shell提示符下获取命令帮助

  1. <span style="color: #000000;">###如下示例
  2. [root@node1 </span>~]# mysqlfailover --help|<span style="color: #0000ff;">head</span><span style="color: #000000;">
  3. MySQL Utilities mysqlfailover version </span><span style="color: #800080;">1.6</span>.<span style="color: #800080;">4</span><span style="color: #000000;">
  4. License type: GPLv2
  5. Usage: mysqlfailover </span>--master=root@localhost --discover-slaves-<span style="color: #0000ff;">login</span>=<span style="color: #000000;">root
  6. </span>--candidates=root@host123:<span style="color: #800080;">3306</span>,root@host456:<span style="color: #800080;">3306</span><span style="color: #000000;">
  7. mysqlfailover </span>-<span style="color: #000000;"> automatic replication health monitoring and failover
  8. Options:
  9. </span>--version show program<span style="color: #800000;">‘</span><span style="color: #800000;">s version number and exit</span>
  10. --<span style="color: #000000;">help display this help message and exit
  11. </span>--license display program<span style="color: #800000;">‘</span><span style="color: #800000;">s license and exit</span>

 

3、基于Linux man获取命令帮助

  1. <span style="color: #000000;">###如下示例
  2. root@node1 </span>~]# <span style="color: #0000ff;">man</span><span style="color: #000000;"> mysqlfailover
  3. MYSQLFAILOVER(</span><span style="color: #800080;">1</span>) MySQL Utilities MYSQLFAILOVER(<span style="color: #800080;">1</span><span style="color: #000000;">)
  4. NAME
  5. mysqlfailover </span>-<span style="color: #000000;"> Automatic replication master failover
  6. SYNOPSIS
  7. mysqlfailover [options]</span>

 

【转】MySQL-Utilities,mysql工具包

标签:usr   metadata   option   create   main   moni   final   cap   安装mysql   

人气教程排行