search
HomeDatabaseMysql TutorialMySQL Utilities toolkit overview and installation

MySQL Utilities is a set of command line utility tools based on the python library written in Python language, and relies on python 2.6. This tool provides some tools commonly used in MySQL database operation and maintenance projects, such as cloning, copying, comparison, difference, export, import, installation, configuration, indexing, disk viewing, etc. With this tool kit, you can be like those miraculous doctors who can do a test or a CT scan regardless of whether they are serious or minor. You can also be Hua Tuo. MySQL Utilities provides software packages for various platforms. If you do not find the package corresponding to your platform, you can compile and install it through the source code. This article mainly describes the installation of MySQL Utilities and a preliminary description of each working function.

1. MySQL Utilities functions and components

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

2. Installation requirements and download address

    需求
            Python 2.6
            MySQL Connector/Python 连接器
    下载地址:
            http://www.php.cn/

3. Installation examples

###本次安装使用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

4. Get help

1. Get help through mysqluc
You can get help information for these tools by calling the mysqluc command line tool
mysqluc provides a built-in command Line prompt window,
You can also complete corresponding command operations in this window [root@node1 ~]# mysqlucLaunching console ...


Welcome to the MySQL Utilities Client (mysqluc) version 1.6.4Copyright (c) 2010, 2016 Oracle and/or its affiliates. All rights reserved.
This is a release of dual licensed MySQL Utilities. For the avoidance ofdoubt, 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 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://www.php.cn/mysqlauditadmin - audit log maintenance utility 
Options:
Option                     Description                                     
-------------------------  --------------------------------------------------version                  
show program&#39;s version number and exit          --help                     
display this help message and exit              --license                  
display program&#39;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 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 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 = 0, 4294967295    
                           2、直接在shell提示符下获取命令帮助###如下示例[root@node1 ~]
                           # mysqlfailover --help|headMySQL 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 failover
Options:  --version             show program&#39;s version number and exit
  --help                display this help message and exit
  --license             display program&#39;s license and exit 3、基于Linux man获取命令帮助###如下示例root@node1 ~]
  # man mysqlfailoverMYSQLFAILOVER(1)                MySQL Utilities               MYSQLFAILOVER(1)
NAME
       mysqlfailover - Automatic replication master failover
SYNOPSIS
       mysqlfailover [options]

######
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
图文详解mysql架构原理图文详解mysql架构原理May 17, 2022 pm 05:54 PM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于架构原理的相关内容,MySQL Server架构自顶向下大致可以分网络连接层、服务层、存储引擎层和系统文件层,下面一起来看一下,希望对大家有帮助。

mysql怎么替换换行符mysql怎么替换换行符Apr 18, 2022 pm 03:14 PM

在mysql中,可以利用char()和REPLACE()函数来替换换行符;REPLACE()函数可以用新字符串替换列中的换行符,而换行符可使用“char(13)”来表示,语法为“replace(字段名,char(13),'新字符串') ”。

mysql怎么去掉第一个字符mysql怎么去掉第一个字符May 19, 2022 am 10:21 AM

方法:1、利用right函数,语法为“update 表名 set 指定字段 = right(指定字段, length(指定字段)-1)...”;2、利用substring函数,语法为“select substring(指定字段,2)..”。

mysql的msi与zip版本有什么区别mysql的msi与zip版本有什么区别May 16, 2022 pm 04:33 PM

mysql的msi与zip版本的区别:1、zip包含的安装程序是一种主动安装,而msi包含的是被installer所用的安装文件以提交请求的方式安装;2、zip是一种数据压缩和文档存储的文件格式,msi是微软格式的安装包。

mysql怎么将varchar转换为int类型mysql怎么将varchar转换为int类型May 12, 2022 pm 04:51 PM

转换方法:1、利用cast函数,语法“select * from 表名 order by cast(字段名 as SIGNED)”;2、利用“select * from 表名 order by CONVERT(字段名,SIGNED)”语句。

MySQL复制技术之异步复制和半同步复制MySQL复制技术之异步复制和半同步复制Apr 25, 2022 pm 07:21 PM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于MySQL复制技术的相关问题,包括了异步复制、半同步复制等等内容,下面一起来看一下,希望对大家有帮助。

带你把MySQL索引吃透了带你把MySQL索引吃透了Apr 22, 2022 am 11:48 AM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了mysql高级篇的一些问题,包括了索引是什么、索引底层实现等等问题,下面一起来看一下,希望对大家有帮助。

mysql怎么判断是否是数字类型mysql怎么判断是否是数字类型May 16, 2022 am 10:09 AM

在mysql中,可以利用REGEXP运算符判断数据是否是数字类型,语法为“String REGEXP '[^0-9.]'”;该运算符是正则表达式的缩写,若数据字符中含有数字时,返回的结果是true,反之返回的结果是false。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)