---
title: "查看MySQL状态的方法"
author: "simen_net"
date: "2010-01-22T16:45:12Z"
tags: []
categories: ["数据库"]
slug: "mysql"
draft: false
lastmod: "2010-01-23T09:29:50Z"
id: 577585
url: "https://simen-net.iteye.com/blog/577585"
---

学习笔记：

发现在JPA中执行SQL时无法执行 SHOW \** 的语句，找了一些资料发现还有另外的方法，留在此处作个笔记

 

 

```
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
--SHOW VARIABLES

SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS
--SHOW STATUS

SELECT * FROM INFORMATION_SCHEMA.ENGINES
--SHOW ENGINES
```

 

另外还可以通过命令行查看信息如：

 

查看MySQL版本等信息

root@simen-laptop:~# mysql -u\*\** -p\*\*\*\*\*\*\*\*\*-e status  
\--------------  
mysql  Ver 14.14 Distrib 5.1.37, for debian-linux-gnu (x86\_64) using  EditLine wrapper

Connection id:        370  
SSL:            Not in use  
Current pager:        stdout  
Using outfile:        ''  
Using delimiter:    ;  
Server version:        5.1.37-1ubuntu5 (Ubuntu)  
Protocol version:    10  
Connection:        Localhost via UNIX socket  
Client characterset:    latin1  
Server characterset:    latin1  
UNIX socket:        /var/run/mysqld/mysqld.sock  
Uptime:            1 day 8 hours 37 min 1 sec

Threads: 9  Questions: 33009  Slow queries: 0  Opens: 224  Flush tables: 1  Open tables: 49  Queries per second avg: 0.281  
\--------------

 

查看运行状态

root@simen-laptop:~# mysqladmin -u\*\*\*\** -p\*\*\*\** extended-status  
+-----------------------------------+-----------+  
| Variable\_name                     | Value     |  
+-----------------------------------+-----------+  
| Aborted\_clients                   | 5         |  
| Aborted\_connects                  | 5         |  
| Binlog\_cache\_disk\_use             | 0         |  
| Binlog\_cache\_use                  | 0         |  
| Bytes\_received                    | 1126312   |  
| Bytes\_sent                        | 155498067 |  
| Com\_admin\_commands                | 4         |  
| Com\_assign\_to\_keycache            | 0         |  
| Com\_alter\_db                      | 0         |  
| Com\_alter\_db\_upgrade              | 0         |  
| Com\_alter\_event                   | 0         |

...........................