视频1 视频21 视频41 视频61 视频文章1 视频文章21 视频文章41 视频文章61 推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37 推荐39 推荐41 推荐43 推荐45 推荐47 推荐49 关键词1 关键词101 关键词201 关键词301 关键词401 关键词501 关键词601 关键词701 关键词801 关键词901 关键词1001 关键词1101 关键词1201 关键词1301 关键词1401 关键词1501 关键词1601 关键词1701 关键词1801 关键词1901 视频扩展1 视频扩展6 视频扩展11 视频扩展16 文章1 文章201 文章401 文章601 文章801 文章1001 资讯1 资讯501 资讯1001 资讯1501 标签1 标签501 标签1001 关键词1 关键词501 关键词1001 关键词1501 专题2001
mysqladmin管理命令详细应用
2020-11-09 12:09:35 责编:小采
文档


mysqladmin 工具的使用格式:mysqladmin [option] command [command option] command ......option 选项:-c number 自动运行次

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.


-O, --set-variable=name
Change the value of a variable. Please note that this
option is deprecated; you can set variables directly with
--variable-name=value.修改变量的值,该选项已经不再使用,请使用--variable-name=value 的方式修改变量值
-s, --silent Silently exit if one can't connect to server.
-S, --socket=name Socket file to use for connection. 指定socket file
-i, --sleep=# Execute commands again and again with a sleep between. 间隔一段时间执行一次
-u, --user=name User for login if not current user.登录数据库用户名
-v, --verbose Write more information. 写更多的信息
-V, --version Output version information and exit. 显示版本

./mysql -uroot -p -V


-E, --vertical Print output vertically. Is similar to --relative, but
prints output vertically.
-w, --wait[=#] Wait and retry if connection is down. 如果连接断开,等待w 指定的时间后重试
--connect_timeout=#
--shutdown_timeout=#

1、查看服务器的状况:status

./mysql -uroot -p status

显示结果:

Uptime: 4883162 Threads: 1 Questions: 86 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 18 Queries per second avg: 0.000

2.修改root 密码:

mysqladmin -u root -poldpassword password 'newpassword'

3.检查mysqlserver是否可用:

mysqladmin -uroot -p ping

显示结果:

mysqld is alive

4.查询服务器的版本

mysqladmin -uroot -p version

下载本文
显示全文
专题