mysql-utilities 管理工具集的使用

來源:互聯網
上載者:User

標籤:工具   故障   lin   cal   nec   安裝過程   generate   disk   use   

mysql-utilities 管理工具集的使用:

更詳細的參數 ,參照官方文檔: https://dev.mysql.com/doc/mysql-utilities/


直接去MySQL官網下載rpm包安裝即可。如果安裝過程中提示mysql-connector-python版本過低,則到mysql官網去下載個最新的封裝上即可。

       社區版用不到或者不常用的功能,筆記這裡就不列出來了。


mysqldbcopy   複製整個庫

例:mysqldbcopy --source=root:'123456'@localhost:3306:/tmp/mysql.sock --destination=root:'123456'@localhost:3306:/tmp/mysql.sock db:db_clone

mysqldiskusage 統計資料表空間、各種記錄檔佔用的體積

例:mysqldiskusage --server=root:'123456'@localhost:3306:/tmp/mysql.sock  --all -v

mysqlfrm   在故障的時候根據frm提取某個表結構 (不包括外鍵約束、自增長序列編號)

例: mysqlfrm --basedir=/usr/local/mysql /data/hellodb/classes.frm --port=3310 --user=root  # 注意這個連接埠是隨便起的


mysqlindexcheck  找出某個庫下的冗餘索引

例:mysqlindexcheck --server=root:'123456'@localhost:3306:/tmp/mysql.sock grafana -f vertical -r -d --stats 


mysqlprocgrep  找出符合某些條件的使用者串連

參數:

  -G, --basic-regexp, --regexp

                        use 'REGEXP' operator to match pattern. Default is to

                        use 'LIKE'.

  -Q, --print-sql, --sql

                        print the statement instead of sending it to the

                        server. If a kill option is submitted, a procedure

                        will be generated containing the code for executing

                        the kill.

  --sql-body            only print the body of the procedure.

  --kill-connection     kill all matching connections.

  --kill-query          kill query for all matching processes.

  --print               print all matching processes.

  -f FORMAT, --format=FORMAT

                        display the output in either grid (default), tab, csv,

                        or vertical format

  -v, --verbose         control how much information is displayed. e.g., -v =

                        verbose, -vv = more verbose, -vvv = debug

  --match-id=PATTERN    match the 'ID' column of the PROCESSLIST table.

  --match-user=PATTERN  match the 'USER' column of the PROCESSLIST table.

  --match-host=PATTERN  match the 'HOST' column of the PROCESSLIST table.

  --match-db=PATTERN    match the 'DB' column of the PROCESSLIST table.

  --match-command=PATTERN

                        match the 'COMMAND' column of the PROCESSLIST table.

  --match-info=PATTERN  match the 'INFO' column of the PROCESSLIST table.

  --match-state=PATTERN

                        match the 'STATE' column of the PROCESSLIST table.

  --age=AGE             show only processes that have been in the current

                        state more than a given time.


例:# kill掉sleep狀態,且處於sleep超過90秒的使用者串連:

mysqlprocgrep  --server=root:'123456'@localhost:3306:/tmp/mysql.sock -f vertical --match-command='Sleep' --age=90s --kill-connection


mysqlrpladmin

關於這個工具,可以參考蘭春大神的博文 https://yq.aliyun.com/articles/59234#


mysqlserverinfo   列出資料庫的明細情況(-d 顯示各個default值, --format=vertical 列式顯示)

例:mysqlserverinfo --server=root:'123456'@localhost:3306:/tmp/mysql.sock   -d --format=vertical


mysqlbinlogpurge   清理到期的binlog檔案

例:mysqlbinlogpurge --server=root:'123456'@localhost:3306:/tmp/mysql.sock





mysql-utilities 管理工具集的使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.