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.6 MySQL Connector/Python 连接器 下载地址: http://www.php.cn/
三、安裝範例
###本次安装使用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
在這個視窗下也可以完成對應的命令操作[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'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 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'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 mysqlfailoverMYSQLFAILOVER(1) MySQL Utilities MYSQLFAILOVER(1) NAME mysqlfailover - Automatic replication master failover SYNOPSIS mysqlfailover [options]

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

MySQL在Web應用中的主要作用是存儲和管理數據。 1.MySQL高效處理用戶信息、產品目錄和交易記錄等數據。 2.通過SQL查詢,開發者能從數據庫提取信息生成動態內容。 3.MySQL基於客戶端-服務器模型工作,確保查詢速度可接受。

在 Docker 中啟動 MySQL 的過程包含以下步驟:拉取 MySQL 鏡像創建並啟動容器,設置根用戶密碼並映射端口驗證連接創建數據庫和用戶授予對數據庫的所有權限

Laravel 是一款 PHP 框架,用於輕鬆構建 Web 應用程序。它提供一系列強大的功能,包括:安裝: 使用 Composer 全局安裝 Laravel CLI,並在項目目錄中創建應用程序。路由: 在 routes/web.php 中定義 URL 和處理函數之間的關係。視圖: 在 resources/views 中創建視圖以呈現應用程序的界面。數據庫集成: 提供與 MySQL 等數據庫的開箱即用集成,並使用遷移來創建和修改表。模型和控制器: 模型表示數據庫實體,控制器處理 HTTP 請求。

在開發一個小型應用時,我遇到了一個棘手的問題:需要快速集成一個輕量級的數據庫操作庫。嘗試了多個庫後,我發現它們要么功能過多,要么兼容性不佳。最終,我找到了minii/db,這是一個基於Yii2的簡化版本,完美地解決了我的問題。

文章摘要:本文提供了詳細分步說明,指導讀者如何輕鬆安裝 Laravel 框架。 Laravel 是一個功能強大的 PHP 框架,它 упростил 和加快了 web 應用程序的開發過程。本教程涵蓋了從系統要求到配置數據庫和設置路由等各個方面的安裝過程。通過遵循這些步驟,讀者可以快速高效地為他們的 Laravel 項目打下堅實的基礎。

優雅安裝 MySQL 的關鍵在於添加 MySQL 官方倉庫。具體步驟如下:下載 MySQL 官方 GPG 密鑰,防止釣魚攻擊。添加 MySQL 倉庫文件:rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm更新 yum 倉庫緩存:yum update安裝 MySQL:yum install mysql-server啟動 MySQL 服務:systemctl start mysqld設置開機自啟動

MySQL和phpMyAdmin是強大的數據庫管理工具。 1)MySQL用於創建數據庫和表、執行DML和SQL查詢。 2)phpMyAdmin提供直觀界面進行數據庫管理、表結構管理、數據操作和用戶權限管理。

在 CentOS 上安裝 MySQL 涉及以下步驟:添加合適的 MySQL yum 源。執行 yum install mysql-server 命令以安裝 MySQL 服務器。使用 mysql_secure_installation 命令進行安全設置,例如設置 root 用戶密碼。根據需要自定義 MySQL 配置文件。調整 MySQL 參數和優化數據庫以提升性能。
