一、功能
客户端执行管理操作mysql数据库的工具
二、应用演示
mysqladmin是一个执行管理操作的客户端程序。它可以用来检查服务器的配置和当前状态、创建和删除数据库等。
mysqladmin 工具的使用格式:mysqladmin [option] command [command option]command …option
option选项
-c, --count=# Number of iterations to make. This works with -i
(--sleep) only.
-f, --force Don't ask for confirmation on drop database; with
multiple commands, continue even if an error occurs.
-C, --compress Use compression in server/client protocol.
--character-sets-dir=name
Directory for character set files.
--default-character-set=name
Set the default character set.
-?, --help Display this help and exit.
-h, --host=name Connect to host.
-b, --no-beep Turn off beep on error.
-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 or 0 for default to, in
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/services, built-in default (3306).
--protocol=name The protocol to use for connection (tcp, socket, pipe,
memory).
-r, --relative Show difference between current and previous values when
used with -i. Currently only works with extended-status.
-s, --silent Silently exit if one can't connect to server.
-S, --socket=name The socket file to use for connection.
-i, --sleep=# Execute commands repeatedly 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.
-E, --vertical Print output vertically. Is similar to --relative, but
prints output vertically.
-w, --wait[=#] Wait and retry if connection is down.
1、查看服务器状态
[root@localhost ~]# mysqladmin -uroot -p status
Enter password:
Uptime: 388 Threads: 2 Questions: 3 Slow queries: 0 Opens: 131 Flush tables: 3 Open tables: 35 Queries per second avg: 0.007
2、修改root密码
[root@localhost ~]# mysqladmin