mysqladmin的用法簡介

kumu_linux發表於2012-07-04
mysqladmin  MySQL客戶端管理工具

  flush-hosts           Flush all cached hosts (max_connect_errors)
                        重新整理主機緩衝中的所有資訊
  flush-logs            Flush all logs
                        重新整理所有日誌
  flush-status          Clear status variables
                        清除狀態變數
  flush-tables          Flush all tables
                        重新整理所有表
  flush-threads         Flush the thread cache
                        重新整理執行緒快取
  flush-privileges      Reload grant tables (same as reload)
                        重新載入授權表(類似reload)
  create db_name        Create a new database named db_name.
  debug                 Tell the server to write debug information to the error log.
  drop db_name          Delete the database named db_name and all its tables.
  extended-status       Display the server status variables and their values.
  kill id,id,...
  old-password new-password    修改密碼
  password new-password        設定一個新密碼
 
-------------------------------------------------------------------------
# mysqladmin -uroot password aixocm      給root設定一個密碼
# mysqladmin -uroot -p proc stat    檢視Mysql的狀態值
Enter password:
+----+------+-----------+----+---------+------+-------+------------------+
| Id | User | Host      | db | Command | Time | State | Info             |
+----+------+-----------+----+---------+------+-------+------------------+
| 8  | root | localhost |    | Query   | 0    |       | show processlist |
+----+------+-----------+----+---------+------+-------+------------------+
Uptime: 148  Threads: 1  Questions: 8  
Slow queries: 0  Opens: 33  Flush tables: 1  
Open tables: 26  Queries per second avg: 0.054
Uptime     --> MySQL伺服器已經執行的秒數
Threads    --> 活動執行緒(客戶)的數目
Questions    --> 伺服器啟動以來客戶的問題(查詢)數目
Slow Query    --> 執行時間超過long_query_time秒的查詢的數量
Opens    --> 伺服器已經開啟的資料庫表的數量
Flush tables    --> 伺服器已經執行的flush ...、refresh和reload命令的數量
Open tables    --> 目前開啟的表的數量


 
# mysqladmin -uroot -paixocm version  --> 通過mysqladmin檢視資料庫版本
mysqladmin  Ver 8.42 Distrib 5.1.52, for redhat-linux-gnu on i386
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version        5.5.20-ndb-7.2.5
Protocol version    10
Connection        Localhost via UNIX socket
UNIX socket        /var/lib/mysql/mysql.sock
Uptime:            4 min 8 sec

Threads: 1  Questions: 9  Slow queries: 0  Opens: 33  Flush tables: 1  Open tables: 26  Queries per second avg: 0.036


相關文章