mysqladmin的用法简介

本文深入解析了MySQL客户端管理工具中的几个关键命令:flush-hosts、flush-logs、flush-status等,提供了刷新数据库缓存、日志、状态变量等功能,并通过实例演示了如何使用这些命令。此外,还展示了如何通过mysqladmin命令查看服务器状态、版本信息,以及如何设置和修改密码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

mysqladmin  MySQL客户端管理工具

  flush-hosts           Flush all cached hosts (max_connect_errors)
                        刷新主机缓冲中的所有信息
  flush-logs            Flush all logs
                        刷新所有日志
  flush-status          Clear status variables
                        清除状态变量
  flush-tables          Flush all tables
                        刷新所有表
  flush-threads         Flush the thread cache
                        刷新线程缓存
  flush-privileges      Reload grant tables (same as reload)
                        重新载入授权表(类似reload)
  create db_name        Create a new database named db_name.
  debug                 Tell the server to write debug information to the error log.
  drop db_name          Delete the database named db_name and all its tables.
  extended-status       Display the server status variables and their values.
  kill id,id,...
  old-password new-password    修改密码
  password new-password        设置一个新密码
 
-------------------------------------------------------------------------
# mysqladmin -uroot password aixocm      给root设置一个密码
# mysqladmin -uroot -p proc stat    查看Mysql的状态值
Enter password:
+----+------+-----------+----+---------+------+-------+------------------+
| Id | User | Host      | db | Command | Time | State | Info             |
+----+------+-----------+----+---------+------+-------+------------------+
| 8  | root | localhost |    | Query   | 0    |       | show processlist |
+----+------+-----------+----+---------+------+-------+------------------+
Uptime: 148  Threads: 1  Questions: 8  
Slow queries: 0  Opens: 33  Flush tables: 1  
Open tables: 26  Queries per second avg: 0.054
Uptime     --> MySQL服务器已经运行的秒数
Threads    --> 活动线程(客户)的数目
Questions    --> 服务器启动以来客户的问题(查询)数目
Slow Query    --> 执行时间超过long_query_time秒的查询的数量
Opens    --> 服务器已经打开的数据库表的数量
Flush tables    --> 服务器已经执行的flush ...、refresh和reload命令的数量
Open tables    --> 目前打开的表的数量


 
# mysqladmin -uroot -paixocm version  --> 通过mysqladmin查看数据库版本
mysqladmin  Ver 8.42 Distrib 5.1.52, for redhat-linux-gnu on i386
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version        5.5.20-ndb-7.2.5
Protocol version    10
Connection        Localhost via UNIX socket
UNIX socket        /var/lib/mysql/mysql.sock
Uptime:            4 min 8 sec

Threads: 1  Questions: 9  Slow queries: 0  Opens: 33  Flush tables: 1  Open tables: 26  Queries per second avg: 0.036


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值