1、SHOW CHARACTER SET 显示所有可用的字符集

mysql> SHOW CHARACTER SET LIKE 'utf8';
+---------+---------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------+-------------------+--------+
| utf8 | UTF-8 Unicode | utf8_general_ci | 3 |
+---------+---------------+-------------------+--------+
1 row in set (0.00 sec)

2、SHOW COLLATION 显示所有的校对规则

mysql> SHOW CHARACTER SET LIKE 'utf8';
+---------+---------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------+-------------------+--------+
| utf8 | UTF-8 Unicode | utf8_general_ci | 3 |
+---------+---------------+-------------------+--------+
1 row in set (0.00 sec)

3、SHOW COLUMNS 显示在一个给定表中的各列的信息(等同于DESC)

mysql> SHOW COLUMNS FROM zjf.a1;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | NO | | NULL | |
+-------+---------+------+-----+---------+-------+
1 row in set (0.15 sec)

4、SHOW CREATE TABLE 显示用于创建给定表的CREATE TABLE语句

mysql> SHOW CREATE TABLE zjf.a1;
+-------+----------------------------------------------------------------------------------+
| Table | Create Table |
+-------+----------------------------------------------------------------------------------+
| a1 | CREATE TABLE `a1` (
`id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+----------------------------------------------------------------------------------+
1 row in set (0.00 sec)

5、SHOW OPEN TABLES 显示数据库中正在打开的表

mysql> SHOW OPEN TABLES FROM zjf;
+----------+-------+--------+-------------+
| Database | Table | In_use | Name_locked |
+----------+-------+--------+-------------+
| zjf | a1 | 0 | 0 |
+----------+-------+--------+-------------+
1 row in set (0.00 sec)

6、SHOW TABLES 显示数据库的所有表

mysql> USE zjf;
Database changed
mysql> SHOW TABLES;
+---------------+
| Tables_in_zjf |
+---------------+
| a1 |
+---------------+
1 row in set (0.00 sec)

7、SHOW TABLE STATUS 性质与SHOW TABLE类似,不过,可以提供每个表的大量信息

mysql> SHOW TABLE STATUS FROM zjf WHERE Name='a1';
+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
| a1 | InnoDB | 10 | Dynamic | 0 | 0 | 16384 | 0 | 0 | 0 | NULL | 2016-02-17 11:24:19 | NULL | NULL | utf8_general_ci | NULL | | |
+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
1 row in set (0.00 sec)

8、SHOW DATABASES 在MySQL服务器主机上列举数据库

mysql> SHOW DATABASES LIKE 'zjf';
+----------------+
| Database (zjf) |
+----------------+
| zjf |
+----------------+
1 row in set (0.00 sec)

9、SHOW ENGINE 显示存储引擎的日志或状态信息

mysql> SHOW ENGINE innodb status \G
*************************** 1. row ***************************
Type: InnoDB
Name:
Status:
=====================================
2016-02-17 13:28:24 0x7f9eeea16700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 24 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 4 srv_active, 0 srv_shutdown, 7149 srv_idle
srv_master_thread log flush and writes: 7153
...

10、SHOW ENGINES 显示存储引擎的状态信息

mysql> SHOW ENGINES;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| CSV | YES | CSV storage engine | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)

11、SHOW ERRORS 本语句与SHOW WARNINGS接近,不过该语句只显示错误,不同时显示错误、警告和注意。

mysql> SHOW ERRORS;
+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Error | 1064 | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE 'DEFAULT'' at line 1 |
+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec) mysql> SHOW COUNT(*) ERRORS;
+-----------------------+
| @@session.error_count |
+-----------------------+
| 1 |
+-----------------------+
1 row in set (0.00 sec)

12、SHOW WARNINGS显示由上一个生成消息的语句导致的错误、警告和注意消息。

mysql> SHOW WARNINGS;
Empty set (0.08 sec) mysql> SHOW COUNT(*) WARNINGS;
+-------------------------+
| @@session.warning_count |
+-------------------------+
| 0 |
+-------------------------+
1 row in set (0.00 sec)

13、SHOW VARIABLES显示了部门MySQL系统变量的值

mysql> SHOW VARIABLES LIKE 'version';
+---------------+--------+
| Variable_name | Value |
+---------------+--------+
| version | 5.7.11 |
+---------------+--------+
1 row in set (0.00 sec)

14、 SHOW GRANTS 用户账户复制权限时必须发布的GRANT语句

mysql> SHOW GRANTS;
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
2 rows in set (0.00 sec)

15、SHOW INDEX 返回表索引信息

mysql> SHOW INDEX FROM mysql.user;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| user | 0 | PRIMARY | 1 | Host | A | NULL | NULL | NULL | | BTREE | | |
| user | 0 | PRIMARY | 2 | User | A | 2 | NULL | NULL | | BTREE | | |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
2 rows in set (0.04 sec)

16、SHOW PRIVILEGES 显示MySQL服务器支持的系统权限清单

mysql> 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 |
...

17、SHOW PROCESSLIST显示哪些线程正在运行(高端)

mysql> show processlist;
+----+------+-----------+------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+----------+------------------+
| 3 | root | localhost | NULL | Query | 0 | starting | show processlist |
+----+------+-----------+------+---------+------+----------+------------------+
1 row in set (0.00 sec)

18、SHOW STATUS提供服务器状态信息

mysql> SHOW STATUS LIKE 'Binlog%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Binlog_stmt_cache_disk_use | 0 |
| Binlog_stmt_cache_use | 0 |
+----------------------------+-------+
4 rows in set (0.05 sec)

19、SHOW TRIGGERS 列出了目前被MySQL服务器定义的触发程序

mysql> SHOW TRIGGERS LIKE 'acc%';
+---------+--------+---------+-------------------------------+--------+---------+
| Trigger | Event | Table | Statement | Timing | Created |
+---------+--------+---------+-------------------------------+--------+---------+
| ins_sum | INSERT | account | SET @sum = @sum + NEW.amount | BEFORE | NULL |
+---------+--------+---------+-------------------------------+--------+---------+

MYSQL SHOW 用法的更多相关文章

  1. 【转载】 mysql explain用法

    转载链接:  mysql explain用法 官网说明:     http://dev.mysql.com/doc/refman/5.7/en/explain-output.html 参数:  htt ...

  2. 知识点:Mysql 基本用法之存储过程

    存储过程 一. 介绍 存储过程包含了一系列可执行的sql语句,存储过程存放于MySQL中,通过调用它的名字可以执行其内部的一堆sql 使用存储过程的优点: 用于替代程序写的SQL语句,实现程序与sql ...

  3. 知识点:Mysql 基本用法之视图

    视图 视图是一个虚拟表(非真实存在),其本质是[根据SQL语句获取动态的数据集,并为其命名],用户使用时只需使用[名称]即可获取结果集,可以将该结果集当做表来使用. 使用视图我们可以把查询过程中的临时 ...

  4. 知识点:Mysql 基本用法之流程控制

    流程控制 一. 条件语句 if 语句实例: delimiter // CREATE PROCEDURE proc_if () BEGIN declare i int default 0; if i = ...

  5. 知识点:Mysql 基本用法之函数

    函数 MySQL中提供了许多内置函数 例如: sql 内置函数: 一.数学函数 ROUND(x,y) 返回参数x的四舍五入的有y位小数的值 RAND() 返回0到1内的随机值,可以通过提供一个参数(种 ...

  6. 知识点:Mysql 基本用法之触发器

    触发器 使用触发器可以定制用户对表进行[增.删.改]操作时前后的行为 注意:没有查询 一 .创建触发器 触发器基础语法: # 插入前 CREATE TRIGGER tri_before_insert_ ...

  7. 知识点:Mysql 基本用法之事务

    事务 事务用于将某些操作的多个SQL作为原子性操作,一旦有某一个出现错误,即可回滚到原来的状态,从而保证数据库数据完整性. 事务实例: create table user( id int primar ...

  8. Mysql基本用法-存储引擎-04

    MYSQL中只有 INNODB和BDB 类型的数据表才能支持事务处理!其他的类型是不支持的!(切记!) Mysql基本用法-存储引擎-02中的test_user表 和 phpcvs表 <?php ...

  9. ThinkPHP第十一天(关联模型使用,独立分组配置,MySQL concat用法)

    1.关联模型的使用 定义方式:新建一个类文件UserRelationModel.class.php Class UserRelationModel extends RelationModel{ pro ...

  10. mysql distinct 用法详解及优化

    本事例实验用表task,结构如下 MySQL> desc task; +-------------+------------+------+-----+-------------------+- ...

随机推荐

  1. 四十九. Zabbix报警机制 、 Zabbix进阶操作 、 监控案例

    案例1:实现Zabbix报警功能 案例2:Zabbix自动发现 案例3:Zabbix主动监控 案例4:拓扑图与聚合图形 案例5:自定义监控案例 1 案例1:实现Zabbix报警功能 1.1 问题 沿用 ...

  2. 1~100卡特兰数(存一下hhhh)

    1 2 5 14 42 132 429 1430 4862 16796 58786 208012 742900 2674440 9694845 35357670 129644790 477638700 ...

  3. pytest学习笔记(一)

    这两天在学习pytest,之前有小用到pytest,觉得这个测试框架很灵巧,用在实现接口自动化(pytest+requests)非常的轻便,然后很有兴致的决定学习下,然后又发现了pytest-sele ...

  4. python3安装web.py

    今天准备测试代理池IPProxyPool获取到ip的质量,在安装web.py的时候遇到了些问题,在此记录一下. 1.安装资料 web.py官网:http://webpy.org/ web.py的git ...

  5. http代理和SOCKS代理的区别

    HTTP 代理按匿名功能分类(是否具有隐藏 IP 的功能) 非匿名代理:不具有匿名功能. 匿名代理.使用此种代理时,虽然被访问的网站不能知道你的 IP 地址,但仍然可 以知道你在使用代理,有些侦测 I ...

  6. fsLayui数据表格使用

    fsLayui 是一个基于layui的快速开发插件,支持数据表格增删改查操作,提供通用的组件,通过配置html实现数据请求,减少前端js重复开发的工作. GitHub下载 码云下载 测试环境地址:ht ...

  7. go语言学习笔记之数组

    package main import ( "fmt" ) func main() { // Declare arrays var x[5] int //Assign value ...

  8. WebService基础学习

    参考 WebService基础学习(一)—基础知识:http://www.cnblogs.com/yangang2013/p/5708647.html WebService基础学习(二)—三要素:ht ...

  9. Flex 布局教程实例

    Flex 布局教程实例 一.Flex 布局是什么? Flex 是 Flexible Box 的缩写,意为"弹性布局",用来为盒状模型提供最大的灵活性. 任何一个容器都可以指定为 F ...

  10. 设置Win10默认启动的Linux子系统版本,启动指定Linux发行版

    设置Win10默认启动的Linux子系统版本,启动指定Linux发行版   MS酋长一年前已经与大家分享了启用“适用于Linux的Windows子系统(WSL)”的方法,但当时所能安装的只有由Cano ...