【转】MySQL-Utilities,mysql工具包
原文:https://blog.csdn.net/leshami/article/details/52795777
MySQL Utilities 是一组基于python语言编写的python库的命令行实用工具集,依赖于python 2.6。该工具提供了MySQL数据库运维工程中常用的一些工具,诸如克隆、复制、比较、差异、导出、导入、安装、配置、索引、磁盘查看等等。有了这个工具包,就好比那些个神医大夫,不管大病小病,先去搞个化验,搞个CT,你也可以当华佗。MySQL Utilities提供了各种平台的软件包,如果没有找到对应自己平台的包,可以通过源码进行编译安装。本文主要描述MySQL Utilities安装以及各个工作功能初步描述。
一、MySQL Utilities功能及组件
Binary Log Operations(二进制日志操作)
mysqlbinlogmove 二进制日志移动
mysqlbinlogpurge 二进制日志清理
mysqlbinlogrotate 二进制日志老化工具 Database Operations(数据库操作)
mysqldbexport 数据导出
mysqldbimport 数据导入
mysqldbcopy 库级别数据库复制
mysqldiff 数据库对象级别比较工具
mysqldbcompare 数据库库级别比较工具 General Operations(通用用的操作)
mysqldiskusage 磁盘空间查看
mysqlfrm 恢复故障表.frm文件
mysqluserclone 用户克隆工具
mysqluc Utilities帮助工具
mysqlindexcheck 索引检测工具
mysqlmetagrep 元数据过滤器
mysqlprocgrep 进程搜索及清理工具 High Availability Operations(高可用)
mysqlreplicate 主从复制工具
mysqlrpladmin 主从复制管理工具
mysqlrplcheck 主从复制检测工具
mysqlrplms 主从多元复制工具
mysqlrplshow 主从复制拓扑图工具
mysqlrplsync 主从复制同步工具
mysqlfailover 主从failover工具
mysqlslavetrx 从库事务跳过工具 Server Operations(服务器操作)
mysqlserverinfo 服务器信息查看工具
mysqlserverclone 服务器克隆工具 Specialized Operations(特殊操作)
mysqlauditadmin 审计管理工具
mysqlauditgrep 审计日志过滤工具
二、安装需求及下载地址
下载官网:https://downloads.mysql.com/archives/utilities/
需求
Python 2.6
MySQL Connector/Python 连接器
下载地址:
http://dev.mysql.com/downloads/utilities/
三、安装示例
###本次安装使用1..4版本,安装前,需要先安装mysql到python连接器
# cat /etc/redhat-release
CentOS release 6.7 (Final)
# rpm -Uvh mysql-connector-python-2.1.-.el6.x86_64.rpm
# rpm -Uvh mysql-utilities-1.6.-.el6.noarch.rpm ###如果没有安装连接器,则收到如下错误提示
# rpm -Uvh mysql-utilities-1.6.-.el6.noarch.rpm
warning: mysql-utilities-1.6.-.el6.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mysql-connector-python >= 2.0. is needed by mysql-utilities-1.6.-.el6.noarch ###查看安装后生成的文件
# rpm -ql mysql-utilities-1.6.-.el6|grep "/usr/bin"
/usr/bin/mysqlauditadmin
/usr/bin/mysqlauditgrep
/usr/bin/mysqlbinlogmove
/usr/bin/mysqlbinlogpurge
/usr/bin/mysqlbinlogrotate
/usr/bin/mysqldbcompare
/usr/bin/mysqldbcopy
/usr/bin/mysqldbexport
/usr/bin/mysqldbimport
/usr/bin/mysqldiff
/usr/bin/mysqldiskusage
/usr/bin/mysqlfailover
/usr/bin/mysqlfrm
/usr/bin/mysqlgrants
/usr/bin/mysqlindexcheck
/usr/bin/mysqlmetagrep
/usr/bin/mysqlprocgrep
/usr/bin/mysqlreplicate
/usr/bin/mysqlrpladmin
/usr/bin/mysqlrplcheck
/usr/bin/mysqlrplms
/usr/bin/mysqlrplshow
/usr/bin/mysqlrplsync
/usr/bin/mysqlserverclone
/usr/bin/mysqlserverinfo
/usr/bin/mysqlslavetrx
/usr/bin/mysqluc
/usr/bin/mysqluserclone
四、获取帮助
、通过mysqluc获取帮助
###可以通过调用mysqluc命令行工具来获取这些工具的帮助信息
### mysqluc提供一个自带的命令行提示符窗口,在这个窗口下也可以完成相应的命令操作 [root@node1 ~]# mysqluc
Launching console ... Welcome to the MySQL Utilities Client (mysqluc) version 1.6.
Copyright (c) , Oracle and/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 of the GNU General Public License.
MySQL Utilities is brought to you by Oracle. Type 'help' for a list of commands or press TAB twice for list of utilities. mysqluc> help
Command Description
---------------------- ---------------------------------------------------
help utilities Display list of all utilities supported.
help <utility> Display help for a specific utility.
show errors Display errors captured during the execution of the
utilities.
clear errors clear captured errors.
show last error Display the last error captured during the
execution of the utilities
help | help commands Show this list.
exit | quit Exit the console.
set <variable>=<value> Store a variable for recall in commands.
show options Display list of options specified by the user on
launch.
show variables Display list of variables.
<ENTER> Press ENTER to execute command.
<ESCAPE> Press ESCAPE to clear the command entry.
<DOWN> Press DOWN to retrieve the previous command.
<UP> Press UP to retrieve the next command in history.
<TAB> Press TAB for type completion of utility, option,
or variable names.
<TAB><TAB> Press TAB twice for list of matching type
completion (context sensitive).
###查看utilities包中所有的命令行工具
mysqluc> help utilities Utility Description
----------------- --------------------------------------------------------
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 file
mysqldbcompare compare databases for 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 object definitions among objects where the
difference is how db1.obj1 differs from db2.obj2
mysqldiskusage show disk usage for databases
mysqlfailover automatic replication health monitoring and failover
mysqlfrm show CREATE TABLE from .frm files
mysqlgrants display grants per object
mysqlindexcheck check for duplicate or redundant indexes
mysqlmetagrep search metadata
mysqlprocgrep search process information
mysqlreplicate establish replication with a master
mysqlrpladmin administration utility for MySQL replication
mysqlrplcheck check replication
mysqlrplms establish multi-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 more new users ###也可直接在mysqluc提示符下输入 help command 来获取对应命令的帮助信息,如下
mysqluc> help mysqlauditadmin
Usage: mysqlauditadmin --server=user:pass@host:port --show-options
# Author : Leshami
# Blog : http://blog.csdn.net/leshami
mysqlauditadmin - audit log maintenance utility Options:
Option Description
------------------------- ------------------------------------------------
--version show program's version number and exit
--help display this 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]>].
--audit-log-name=LOG_NAME full path and file name for the audit log file.
Used for stats and copy options.
--show-options display the audit log system variables.
--remote-login=RLOGIN user name and host to be used for remote login
for copying log files. Format:
<user>:<host_or_ip> Password will be prompted.
--file-stats display the audit log file statistics.
--copy-to=COPY_LOCATION the location to copy the audit log file
specified. The path must be locally accessible
for the current user.
--value=VALUE value used to set variables based on the command
specified. See --help for list per command.
--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 (SSL not required).
-v, --verbose control how much information is displayed. e.g.,
-v = verbose, -vv = more verbose, -vvv = debug
Available Commands: copy - copy the audit log to
a locally accessible path policy - set the audit
log policy Values = ALL, NONE, LOGINS, QUERIES,
DEFAULT rotate - perform audit log rotation
rotate_on_size - set the rotate log size limit
for auto rotation Values = ,
2、直接在shell提示符下获取命令帮助
###如下示例
[root@node1 ~]# mysqlfailover --help|head
MySQL Utilities mysqlfailover version 1.6.
License type: GPLv2
Usage: mysqlfailover --master=root@localhost --discover-slaves-login=root
--candidates=root@host123:,root@host456: mysqlfailover - automatic replication health monitoring and failover Options:
--version show program's version number and exit
--help display this help message and exit
--license display program's license and exit
3、基于Linux man获取命令帮助
###如下示例
root@node1 ~]# man mysqlfailover
MYSQLFAILOVER() MySQL Utilities MYSQLFAILOVER() NAME
mysqlfailover - Automatic replication master failover SYNOPSIS
mysqlfailover [options]
【转】MySQL-Utilities,mysql工具包的更多相关文章
- (5.6)mysql高可用系列——MySQL Utilities 管理工具
关键词:mysql工具集,mysql管理工具,mysql utilities [1]安装mysql utilities cd /download wget https://cdn.mysql.com/ ...
- MySQL utilities介绍&出现 No module named utilities
目录 安装 mysqlreplicate mysqlrplcheck mysqlrplshow mysqlrpladmin mysqlfailover mysqldbcompare 详细介绍 mysq ...
- MySQL管理工具MySQL Utilities — 介绍与安装(1)
MySQL Utilities介绍 MySQL Utilities 提供一组命令行工具用于维护和管理 MySQL 服务器,包括: 管理工具 (克隆.复制.比较.差异.导出.导入) 复制工具 (安装.配 ...
- MySQL Utilities管理工具
前提: 1.安装MySQL Utilities工具 2.复制my_print_defaults命令至/usr/bin下或写入环境变量. 卸载方式: python ./setup.py clean -- ...
- MySQL Utilities工具教程
一.MySQL Utilities介绍 MySQL Utilities 提供一组命令行工具用于维护和管理 MySQL 服务器,包括: 管理工具 (克隆.复制.比较.差异.导出.导入)复制工具 (安装. ...
- 【MySQL】MySQL零碎积累
MySQL零碎积累 ■ 在给MySQL添加新用户时可以这么操作: create user 'newUser' identified by 'password'; grant all privilege ...
- MySQl学习-——Mysql体系结构与Mysql存储引擎
Mysql体系结构与Mysql存储引擎 Mysql体系结构 mysql体系结构图:
- MySQL: Table 'mysql.plugin' doesn't exist的解决
安装解压版MySQL以后,不能启动,日志里面出现了这个错误: MySQL: Table 'mysql.plugin' doesn't exist 这是因为mysql服务启动时候找不到内置数据库&quo ...
- MySql 及 MySql WorkBench使用大全
Mysql安装步骤 1. 下载MySQL Community Server 5.6.13 2. 解压MySQL压缩包 将以下载的MySQL压缩包解压到自定义目录下,我的解压目录是: "D:\ ...
- mac使用终端运行mysql,mysql终端,mysql mac,mysql目录,mysql路径
首先去官网下载: http://www.mysql.com/downloads/ 我下载了5.6.11的dmg然后安装,安装完成之后..如果要用终端去玩SQL.那么一开始要输入很长的:/usr/loc ...
随机推荐
- OpenCV笔记(5)(定位票据并规范化、调库扫描文本)
一.定位和变换票据 定位照片中的不规范票据或矩形文本,并将其变换为正规矩形,以供OCR识别. # -*- coding:utf-8 -*- __author__ = 'Leo.Z' import cv ...
- jquery disabled选择器 语法
jquery disabled选择器 语法 作用:disabled 选择器选取所有禁用的表单元素.大理石平台价格表 语法:$(":disabled") jquery disable ...
- css grid 随笔
原文出自Arien的博客https://www.w3cplus.com/css3/line-base-placement-layout.html 首先定义一个网格 1.可以给父容器的display属性 ...
- codevs2370 小机房的树 x
2370 小机房的树 时间限制: 1 s 空间限制: 256000 KB 题目等级 : 钻石 Diamond 题目描述 Description 小机房有棵焕狗种的树,树上有N个节点,节点标号 ...
- Springboot入门实战, 使用@Value
今天开始最简单的Springboot应用 entity.Book package com.draymonder.amor.entity; import java.util.List; import o ...
- ZOJ3649 Social Net
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3649 这题倍增维护信息之多,也能算是一道毒瘤题了-- 解题思路 ...
- TCP连接数配置
一般的设置规则为: 系统最大文件数>可用端口>用户最大文件数 sysctl -a | grep file-max cat /proc/sys/fs/file-max 这表明这台Linux系 ...
- css彩色(渐变)文字
css彩色文字也称渐变文字 在张鑫旭博客首页看到这效果,就自己研究了一下. 实现方法加个背景然后在根据文本剪切,再把文本填充为透明色让之前设置的背景颜色显示出来即可. -webkit-backgrou ...
- 解决idea无法显示中文候选框问题
第一:先找到idea安装目录,找到文件jre64,把它命名为“jre642”,也可以随意命名 第二步:找到Javaan安装目录下的jre ,把它复制到idea安装目录下,命名为“jre64”. 第三 ...
- linux如何查看所有的用户和组信息(转载)
[步骤一]cat /etc/passwdcat /etc/passwd查看所有的用户信息,详情如下图 [步骤二]cat /etc/passwd|grep 用户名 cat /etc/passwd|gre ...