查看MySQL状态的步骤

查看MySQL状态的方法

学习笔记:

发现在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         |

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