MySQL Utilities工具包概述及安装

2023-10-10 20:48

本文主要是介绍MySQL Utilities工具包概述及安装,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

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     审计日志过滤工具

二、安装需求及下载地址

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

三、安装示例

###本次安装使用1.6.4版本,安装前,需要先安装mysql到python连接器
# cat /etc/redhat-release 
CentOS release 6.7 (Final)
# rpm -Uvh mysql-connector-python-2.1.4-1.el6.x86_64.rpm 
# rpm -Uvh mysql-utilities-1.6.4-1.el6.noarch.rpm ###如果没有安装连接器,则收到如下错误提示
# rpm -Uvh mysql-utilities-1.6.4-1.el6.noarch.rpm 
warning: mysql-utilities-1.6.4-1.el6.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:mysql-connector-python >= 2.0.0 is needed by mysql-utilities-1.6.4-1.el6.noarch###查看安装后生成的文件        
# rpm -ql mysql-utilities-1.6.4-1.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    

四、获取帮助

1、通过mysqluc获取帮助
###可以通过调用mysqluc命令行工具来获取这些工具的帮助信息
### mysqluc提供一个自带的命令行提示符窗口,在这个窗口下也可以完成相应的命令操作[root@node1 ~]# mysqluc
Launching console ...Welcome to the MySQL Utilities Client (mysqluc) version 1.6.4
Copyright (c) 2010, 2016 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 2 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 theutilities.                                         
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 commandspecified. 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 establishinga 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).                   
-v, --verbose              control how much information is displayed. e.g.,-v = verbose, -vv = more verbose, -vvv = debug  Available Commands: copy - copy the audit log toa locally accessible path policy - set the auditlog 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 = 0, 4294967295    2、直接在shell提示符下获取命令帮助
###如下示例
[root@node1 ~]# mysqlfailover --help|head
MySQL Utilities mysqlfailover version 1.6.4 
License type: GPLv2
Usage: mysqlfailover --master=root@localhost --discover-slaves-login=root --candidates=root@host123:3306,root@host456:3306 mysqlfailover - automatic replication health monitoring and failoverOptions:--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(1)                MySQL Utilities               MYSQLFAILOVER(1)NAMEmysqlfailover - Automatic replication master failoverSYNOPSISmysqlfailover [options]

DBA牛鹏社(SQL/NOSQL/LINUX)

这篇关于MySQL Utilities工具包概述及安装的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/182984

相关文章

Java通过驱动包(jar包)连接MySQL数据库的步骤总结及验证方式

《Java通过驱动包(jar包)连接MySQL数据库的步骤总结及验证方式》本文详细介绍如何使用Java通过JDBC连接MySQL数据库,包括下载驱动、配置Eclipse环境、检测数据库连接等关键步骤,... 目录一、下载驱动包二、放jar包三、检测数据库连接JavaJava 如何使用 JDBC 连接 mys

SQL中如何添加数据(常见方法及示例)

《SQL中如何添加数据(常见方法及示例)》SQL全称为StructuredQueryLanguage,是一种用于管理关系数据库的标准编程语言,下面给大家介绍SQL中如何添加数据,感兴趣的朋友一起看看吧... 目录在mysql中,有多种方法可以添加数据。以下是一些常见的方法及其示例。1. 使用INSERT I

Qt使用QSqlDatabase连接MySQL实现增删改查功能

《Qt使用QSqlDatabase连接MySQL实现增删改查功能》这篇文章主要为大家详细介绍了Qt如何使用QSqlDatabase连接MySQL实现增删改查功能,文中的示例代码讲解详细,感兴趣的小伙伴... 目录一、创建数据表二、连接mysql数据库三、封装成一个完整的轻量级 ORM 风格类3.1 表结构

MySQL 中的 CAST 函数详解及常见用法

《MySQL中的CAST函数详解及常见用法》CAST函数是MySQL中用于数据类型转换的重要函数,它允许你将一个值从一种数据类型转换为另一种数据类型,本文给大家介绍MySQL中的CAST... 目录mysql 中的 CAST 函数详解一、基本语法二、支持的数据类型三、常见用法示例1. 字符串转数字2. 数字

Mysql实现范围分区表(新增、删除、重组、查看)

《Mysql实现范围分区表(新增、删除、重组、查看)》MySQL分区表的四种类型(范围、哈希、列表、键值),主要介绍了范围分区的创建、查询、添加、删除及重组织操作,具有一定的参考价值,感兴趣的可以了解... 目录一、mysql分区表分类二、范围分区(Range Partitioning1、新建分区表:2、分

MySQL 定时新增分区的实现示例

《MySQL定时新增分区的实现示例》本文主要介绍了通过存储过程和定时任务实现MySQL分区的自动创建,解决大数据量下手动维护的繁琐问题,具有一定的参考价值,感兴趣的可以了解一下... mysql创建好分区之后,有时候会需要自动创建分区。比如,一些表数据量非常大,有些数据是热点数据,按照日期分区MululbU

SQL Server配置管理器无法打开的四种解决方法

《SQLServer配置管理器无法打开的四种解决方法》本文总结了SQLServer配置管理器无法打开的四种解决方法,文中通过图文示例介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的... 目录方法一:桌面图标进入方法二:运行窗口进入检查版本号对照表php方法三:查找文件路径方法四:检查 S

MySQL 删除数据详解(最新整理)

《MySQL删除数据详解(最新整理)》:本文主要介绍MySQL删除数据的相关知识,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录一、前言二、mysql 中的三种删除方式1.DELETE语句✅ 基本语法: 示例:2.TRUNCATE语句✅ 基本语

MySQL中查找重复值的实现

《MySQL中查找重复值的实现》查找重复值是一项常见需求,比如在数据清理、数据分析、数据质量检查等场景下,我们常常需要找出表中某列或多列的重复值,具有一定的参考价值,感兴趣的可以了解一下... 目录技术背景实现步骤方法一:使用GROUP BY和HAVING子句方法二:仅返回重复值方法三:返回完整记录方法四:

从入门到精通MySQL联合查询

《从入门到精通MySQL联合查询》:本文主要介绍从入门到精通MySQL联合查询,本文通过实例代码给大家介绍的非常详细,需要的朋友可以参考下... 目录摘要1. 多表联合查询时mysql内部原理2. 内连接3. 外连接4. 自连接5. 子查询6. 合并查询7. 插入查询结果摘要前面我们学习了数据库设计时要满