时间:2021-07-01 10:21:17 帮助过:4人阅读
mysql 的功能和Oracle 的sqlplus 一样,为用户提供一个命令行接口来操作管理MySQL服务器。
Usage: mysqladmin [OPTIONS] command command ...
mysqadmin,顾名思义,提供的功能都是与MySQL 管理相关的各种功能。如MySQL Server状态检查,各种统计信息的flush,创建/删除数据库,关闭MySQL Server 等等。mysqladmin所能做的事情,虽然大部分都可以通过mysql 连接登录上MySQL Server 之后来完成,但是大部分通过mysqladmin 来完成操作会更简单更方便。这里我将介绍一下自己经常使用到的几个常用功能:
sky@sky:~# mysqladmin -u sky -ppwd -h localhost ping mysqld is alive
sky@sky:~# mysqladmin -u sky -ppwd -h localhost status Uptime: 20960 Threads: 1 Questions: 75 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 9 Queries per second avg: 0.3
[root@test-huanqiu ~]# mysqladmin -uroot -p -i 2 -c 5 status
sky@sky:~# mysqladmin -u sky -ppwd -h localhost processlist +----+------+-----------+----+---------+------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+------+-----------+----+---------+------+-------+------------------+ | 48 | sky | localhost | | Query | 0 | | show processlist | +----+------+-----------+----+---------+------+-------+------------------+
[root@test-huanqiu ~]# mysqladmin -uroot -p-i 1 processlist //每秒刷新一次
[root@test-huanqiu ~]# mysqladmin -u root -p原密码 password ‘newpassword‘
6.查询mysql服务器的版本
[root@test-huanqiu ~]# mysqladmin -uroot -p version
7.查看服务器状态的当前值:
[root@test-huanqiu ~]# mysqladmin -uroot -p extended-status
8.查询服务器系统变量值:
[root@test-huanqiu ~]# mysqladmin -uroot -p variables
9.刷新命令mysqladmin flush commands
[root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-hosts [root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-logs [root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-privileges [root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-status [root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-tables [root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-threads
10.执行kill 进程
[root@test-huanqiu ~]# mysqladmin -uroot -p kill idnum
11.停止和启动MySQL replication on a slave server
[root@test-huanqiu ~]# mysqladmin -u root -p stop-slave [root@test-huanqiu ~]# mysqladmin -u root -p start-slave
mysqldump使用大全
MYSQLDUMP参数详解(转)
mysqlhotcopy不像mysqldump那样是逻辑备份,它是物理备份,但是它支持MyIsam存储引擎。
MySQL 自带工具使用介绍
标签:top stat man mil options 线程 rac info 大量