mysqladmin命令用法

--修改密码

mysqladmin -uroot -ptest passoword 新密码 --不要在新密码后添加分号

--判断服务是否启动

mysqladmin -utest -ptest1 ping

  mysqld is alive

--关闭服务

mysqladmin -utest -ptest1 shutdown

--查看mysql版本

mysqladmin -utest -ptest1 version

--查看所有的全局变量

mysqladmin -utest -ptest1 variables

--mysql的状态

mysqladmin -utest -ptest1 status

--查询所有mysql连接的客户端

C:>mysqladmin -utest -ptest1 processlist
+----+------+----------------+----+---------+------+-------+------------------+
| Id | User | Host           | db | Command | Time | State | Info             |
+----+------+----------------+----+---------+------+-------+------------------+
| 7  | root | localhost:3105 |    | Sleep   | 2    |       |                  |
| 8  | root | localhost:3106 |    | Sleep   | 3    |       |                  |
| 10 | test | localhost:3108 |    | Query   | 0    |       | show processlist |
+----+------+----------------+----+---------+------+-------+------------------+

--杀掉某个客户端的链接

C:>mysqladmin -utest -ptest1 kill 7,8
C:>mysqladmin -utest -ptest1 processlist
+----+------+----------------+----+---------+------+-------+------------------+
| Id | User | Host           | db | Command | Time | State | Info             |
+----+------+----------------+----+---------+------+-------+------------------+
| 12 | test | localhost:3112 |    | Query   | 0    |       | show processlist |
+----+------+----------------+----+---------+------+-------+------------------+

--创建数据库和删除数据库

C:>mysqladmin -utest -ptest1 create aaa

C:>mysqladmin -utest -ptest1 drop aaa
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.
Do you really want to drop the 'aaa;' database [y/N] y
Database "aaa;" dropped

--查询服务器拓展的状态

mysqladmin -utest -ptest1 extended-status

--重载授权表

mysqladmin -utest -ptest1 reload

mysqladmin -utest -ptest1 flush-privileges

原文地址:https://www.cnblogs.com/liaomin416100569/p/9331247.html