mysql 查看信息的命令(show\desc\explain)

/**
 * @file mysql查看信息的命令及帮助命令
 * @author email:[email protected] blog:<a>http://blog.csdn.net/kangquan2008</a>
 */

/*
 *1.好记性不如烂笔头:
 */
1. 查看配置
show variable;
2.查看目前处理的列表;
show processlist;
3.看看有哪些存储过程
show procedure status;
4.查看一条命令的执行方案
explain select * fromt t_your_tabe;
如果是分区表
explain partitions select * from t_your_table;
5. 查看表的信息
desc t_your_table;
6.查看表的创建
show create table t_your_table;
7.查看存储过程的创建
show create procedure p_your_procedure
8.查看所有支持的字符集
use information_schema;
select * from character_sets;
实际上很多信息在mysql和information_schema可以查到
9. 索引
show index from t_your_table;
10. 主服务器
show master status;
11. 从服务器
show  slave status;
12. 查看日志 
show binary logs;
13. 查看状态
show status;
14. 查看user权限
show grant for u_user_name
15. 查看服务器支持的权限
show  privileges;

/*
 *2.记性是一回事,技巧是另一回事:
 */
使用帮助命令来查看自己的目标命名的使用方法
mysql> help search_string
If you provide an argument to the help command, mysql uses it as a search string to access server-side help from the contents of the MySQL Reference Manual. The
proper operation of this command requires that the help tables in the mysql database be initialized with help topic information 
If there is no match for the search string, the search fails:
mysql> help me
Nothing found
Please try to run ´help contents´ for a list of all accessible topics
Use help contents to see a list of the help categories:
mysql> help contents
You asked for help about help category: "Contents"
For more information, type help <item>, where <item> is one of the
following categories:
Account Management
Administration
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Language Structure
Plugins
Storage Engines
Stored Routines
Table Maintenance
Transactions
Triggers
If the search string matches multiple items, mysql shows a list of matching topics:
mysql> help logs
Many help items for your request exist.
To make a more specific request, please type ´help <item>´,
   where <item> is one of the following topics:
   SHOW
   SHOW BINARY LOGS
   SHOW ENGINE
   SHOW LOGS


你可能感兴趣的:(mysql 查看信息的命令(show\desc\explain))