MYSQL show命令大搜查

 1. show tables [from db_name]; — 显示当前数据库中所有表的名称。

2. show databases; — 显示mysql中所有数据库的名称。

3. show columns from table_name from database_name; 或show columns from database_name.table_name; — 显示表中列名称。

4. show grants for user_name; — 显示一个用户的权限,显示结果类似于grant 命令。

5. show index from table_name; — 显示表的索引。

列  含义 

Table  表名

Non_unique  0,如果索引不能包含重复。
 
Key_name  索引名

Seq_in_index  索引中的列顺序号, 从 1 开始。 

Column_name  列名。 

Collation  列怎样在索引中被排序。在MySQL中,这可以有值A(升序) 或NULL(不排序)。
 
Cardinality  索引中唯一值的数量。这可通过运行isamchk -a更改. 

Sub_part  如果列只是部分被索引,索引字符的数量。NULL,如果整个键被索引。 

6. show status; — 显示一些系统特定资源的信息,例如,正在运行的线程数量。

列  含义 
Name  表名

Type  表的类型 (ISAM,MyISAM或HEAP)

Row_format  行存储格式 (固定, 动态, 或压缩)

Rows  行数量

Avg_row_length  平均行长度

Data_length  数据文件的长度

Max_data_length  数据文件的最大长度

Index_length  索引文件的长度

Data_free  已分配但未使用了字节数

Auto_increment  下一个 autoincrement(自动加1)值

Create_time  表被创造的时间

Update_time  数据文件最后更新的时间

Check_time  最后对表运行一个检查的时间

Create_options  与CREATE TABLE一起使用的额外选项 

Comment  当创造表时,使用的注释 (或为什么MySQL不能存取表信息的一些信息)。
 
Aborted_clients  由于客户没有正确关闭连接已经死掉,已经放弃的连接数量。
 
Aborted_connects  尝试已经失败的MySQL服务器的连接的次数。 

Connections  试图连接MySQL服务器的次数。 

Created_tmp_tables  当执行语句时,已经被创造了的隐含临时表的数量。
 
Delayed_insert_threads  正在使用的延迟插入处理器线程的数量。 

Delayed_writes  用INSERT DELAYED写入的行数。 

Delayed_errors  用INSERT DELAYED写入的发生某些错误(可能重复键值)的行数。
 
Flush_commands  执行FLUSH命令的次数。
 
Handler_delete  请求从一张表中删除行的次数。
 
Handler_read_first  请求读入表中第一行的次数。
 
Handler_read_key  请求数字基于键读行。 

Handler_read_next  请求读入基于一个键的一行的次数。
 
Handler_read_rnd  请求读入基于一个固定位置的一行的次数。
 
Handler_update  请求更新表中一行的次数。 

Handler_write  请求向表中插入一行的次数。 

Key_blocks_used  用于关键字缓存的块的数量。
 
Key_read_requests  请求从缓存读入一个键值的次数。 

Key_reads  从磁盘物理读入一个键值的次数。
 
Key_write_requests  请求将一个关键字块写入缓存次数。
 
Key_writes  将一个键值块物理写入磁盘的次数。 

Max_used_connections  同时使用的连接的最大数目。
 
Not_flushed_key_blocks  在键缓存中已经改变但是还没被清空到磁盘上的键块。
 
Not_flushed_delayed_rows  在INSERT DELAY队列中等待写入的行的数量。 

Open_tables  打开表的数量。 

Open_files  打开文件的数量。
 
Open_streams  打开流的数量(主要用于日志记载)

Opened_tables  已经打开的表的数量。 

Questions  发往服务器的查询的数量。
 
Slow_queries  要花超过long_query_time时间的查询数量。 

Threads_connected  当前打开的连接的数量。
 
Threads_running  不在睡眠的线程数量。
 
Uptime  服务器工作了多少秒。 


7. show variables; — 显示系统变量的名称和值。

8. show  [full]  processlist; — 显示系统中正在运行的所有进程,也就是当前正在执行的查询。大多数用户可以查看他们自己的进程,但是如果他们拥有process权限,就可以查看所有人的进程,包括密码。

9.  show table status  [from db_name]; — 显示当前使用(使用use 命令切换数据库)或者指定([from db_name])的database中的每个表的信息。信息包括表类型和表的最新更新时间。

10. show privileges; — 显示服务器所支持的不同权限。
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Privilege               | Context                               | Comment                                               |
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Alter                   | Tables                                | To alter the table                                    |
| Alter routine           | Functions,Procedures                  | To alter or drop stored functions/procedures          |
| Create                  | Databases,Tables,Indexes              | To create new databases and tables                    |
| Create routine          | Databases                             | To use CREATE FUNCTION/PROCEDURE                      |
| Create temporary tables | Databases                             | To use CREATE TEMPORARY TABLE                         |
| Create view             | Tables                                | To create new views                                   |
| Create user             | Server Admin                          | To create new users                                   |
| Delete                  | Tables                                | To delete existing rows                               |
| Drop                    | Databases,Tables                      | To drop databases, tables, and views                  |
| Event                   | Server Admin                          | To create, alter, drop and execute events             |
| Execute                 | Functions,Procedures                  | To execute stored routines                            |
| File                    | File access on server                 | To read and write files on the server                 |
| Grant option            | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess   |
| Index                   | Tables                                | To create or drop indexes                             |
| Insert                  | Tables                                | To insert data into tables                            |
| Lock tables             | Databases                             | To use LOCK TABLES (together with SELECT privilege)   |
| Process                 | Server Admin                          | To view the plain text of currently executing queries |
| Proxy                   | Server Admin                          | To make proxy user possible                           |
| References              | Databases,Tables                      | To have references on tables                          |
| Reload                  | Server Admin                          | To reload or refresh tables, logs and privileges      |
| Replication client      | Server Admin                          | To ask where the slave or master servers are          |
| Replication slave       | Server Admin                          | To read binary log events from the master             |
| Select                  | Tables                                | To retrieve rows from table                           |
| Show databases          | Server Admin                          | To see all databases with SHOW DATABASES              |
| Show view               | Tables                                | To see views with SHOW CREATE VIEW                    |
| Shutdown                | Server Admin                          | To shut down the server                               |
| Super                   | Server Admin                          | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.   |
| Trigger                 | Tables                                | To use triggers                                       |
| Create tablespace       | Server Admin                          | To create/alter/drop tablespaces                      |
| Update                  | Tables                                | To update existing rows                               |
| Usage                   | Server Admin                          | No privileges - allow connect only                

11. show create database database_name; — 显示create database 语句是否能够创建指定的数据库。

12. show create table table_name; — 显示create database 语句是否能够创建指定的数据库。

13. show engines; — 显示安装以后可用的存储引擎和默认引擎。

14. show innodb status; — 显示innoDB存储引擎的状态。

15. show logs; — 显示BDB存储引擎的日志。

16. show warnings; — 显示最后一个执行的语句所产生的错误、警告和通知。

17. show errors; — 只显示最后一个执行语句所产生的错误。

18. show [storage] engines; –显示安装后的可用存储引擎和默认引擎。

19. show ahthors ; MYSQL开发者信息

20. show tables from db_name;

21.show databases like '%t'; 将会列出所有数据库名字末尾为’t‘字符集的数据库

除了status,processlist和grants外,其它的都可以带有like wild选项,它可以使用SQL的'%'和'_'字符;

22. select database(); 查看当前所使用的数据库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值