mysqladmin 管理命令详细应用
mysqladmin 工具的使用格式:
mysqladmin [option] command [command option] command ......
option 选项:
-c number 自动运行次数统计,必须和 -i 一起使用
-i number 间隔多长时间重复执行
每个两秒查看一次服务器的状态,总共重复 5 次。
./mysqladmin -uroot -p -i 2 -c 5 status
-#, --debug[=name] Output debug log. Often this is 'd:t:o,filename'.
-f, --force Don't ask for confirmation on drop database; with
multiple commands, continue even if an error occurs. 禁用错误,drop 数据库时不提示,
执行多条命令时出错继续执行
-C, --compress Use compression in server/client protocol.
--character-sets-dir=name 字符集所在目录
Directory where character sets are.
--default-character-set=name 设置默认字符集
Set the default character set.
-?, --help Display this help and exit. 显示帮助
-h, --host=name Connect to host. 连接的主机名或 iP
-p, --password[=name] 登录密码,如果不写于参数后,则会提示输入
Password to use when connecting to server. If password is
not given it's asked from the tty.
-P, --port=# Port number to use for connection. 指定数据库端口
--protocol=name The protocol of connection (tcp,socket,pipe,memory). 指定连接协议
-r, --relative Show difference between current and previous values when
used with -i. Currently works only with extended-status. 显示前后变化的值,必须结合-
i
./mysqladmin -uroot -p -i 2 -r extended-status
假如此处显示的 uptime 将永远是 2,因为与之前取的结果比只相差 2.