13.7.5 SHOW Statements
13.7.5.1 SHOW BINARY LOGS Statement
列出服务器上的二进制日志文件
SHOW BINARY LOGS
SHOW MASTER LOGS
13.7.5.2 SHOW BINLOG EVENTS Statement
https://dev.mysql.com/doc/refman/5.7/en/show-binlog-events.html
SHOW BINLOG EVENTS [IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]
Shows the events in the binary log. If you do not specify 'log_name', the first binary log is displayed. SHOW BINLOG EVENTS requires the REPLICATION SLAVE privilege.
在二进制日志中显示事件。 如果未指定'log_name',则显示第一个二进制日志。 SHOW BINLOG事件需要REPLICATION SLAVE权限。
SHOW BINLOG EVENTS in 'mysql-bin.000003'
13.7.5.3 SHOW CHARACTER SET Statement
https://dev.mysql.com/doc/refman/5.7/en/show-character-set.html
SHOW CHARACTER SET [LIKE 'pattern' | WHERE expr]
SHOW CHARACTER SET LIKE 'latin%';
SHOW CHARACTER SET LIKE 'utf8%';
The SHOW CHARACTER SET statement shows all available character sets. The LIKE clause, if present, indicates which character set names to match.
SHOW CHARACTER SET语句显示所有可用的字符集。 LIKE子句(如果存在)指示要匹配的字符集名称
13.7.5.4 SHOW COLLATION Statement
https://dev.mysql.com/doc/refman/5.7/en/show-collation.html
SHOW COLLATION [LIKE 'pattern' | WHERE expr]
SHOW COLLATION WHERE Charset = 'latin1';
This statement lists collations supported by the server. By default, the output from SHOW COLLATION includes all available collations. The LIKE clause, if present, indicates which collation names to match. The WHERE clause can be given to select rows using more general conditions, as discussed in Section 23.36, “Extensions to SHOW Statements”. For example:
该语句列出了服务器支持的排序规则。 默认情况下,SHOW COLLATION的输出包括所有可用的排序规则。 LIKE子句(如果存在)指示要匹配的排序规则名称。
13.7.5.5 SHOW COLUMNS Statement
https://dev.mysql.com/doc/refman/5.7/en/show-columns.html
SHOW [FULL] {COLUMNS | FIELDS} {FROM | IN} tbl_name [{FROM | IN} db_name] [LIKE 'pattern' | WHERE expr]
SHOW COLUMNS displays information about the columns in a given table. It also works for views. SHOW COLUMNS displays information only for those columns for which you have some privilege.
SHOW COLUMNS显示有关给定表中列的信息。 它也适用于视图。 SHOW COLUMNS仅显示您具有特权的那些列的信息。
# 这个需要在king的database下执行
SHOW COLUMNS FROM account;
# SHOW COLUMNS FROM mytable FROM mydb;
# SHOW COLUMNS FROM mydb.mytable;
SHOW COLUMNS FROM account from king;
SHOW COLUMNS FROM king.account;
13.7.5.6 SHOW CREATE DATABASE Statement
https://dev.mysql.com/doc/refman/5.7/en/show-create-database.html
SHOW CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name
Shows the CREATE DATABASE statement that creates the named database. If the SHOW statement includes an IF NOT EXISTS clause, the output too includes such a clause. SHOW CREATE SCHEMA is a synonym for SHOW CREATE DATABASE.
显示创建命名数据库的CREATE DATABASE语句。 如果SHOW语句包含IF NOT EXISTS子句,则输出也包含这样的子句。 SHOW CREATE SCHEMA是SHOW CREATE DATABASE的同义词。
SHOW CREATE DATABASE king;
13.7.5.7 SHOW CREATE EVENT Statement
https://dev.mysql.com/doc/refman/5.7/en/show-create-event.html
SHOW EVENTS FROM king;
SHOW CREATE EVENT event_name
This statement displays the CREATE EVENT statement needed to re-create a given event. It requires the EVENT privilege for the database from which the event is to be shown.
该语句显示重新创建给定事件所需的CREATE EVENT语句。 它要求显示事件的数据库具有EVENT权限
13.7.5.8 SHOW CREATE FUNCTION Statement
SHOW CREATE FUNCTION func_name
13.7.5.9 SHOW CREATE PROCEDURE Statement
https://dev.mysql.com/doc/refman/5.7/en/show-create-procedure.html
SHOW CREATE PROCEDURE proc_name
13.7.5.10 SHOW CREATE TABLE Statement
https://dev.mysql.com/doc/refman/5.7/en/show-create-table.html
SHOW CREATE TABLE tbl_name
13.7.5.11 SHOW CREATE TRIGGER Statement
https://dev.mysql.com/doc/refman/5.7/en/show-create-trigger.html
SHOW CREATE TRIGGER trigger_name
13.7.5.12 SHOW CREATE USER Statement
SHOW CREATE USER user
SHOW CREATE USER 'root'@'localhost'\G
# 查用户
select * from mysql.user;
show create user 'root'@'172.%';
13.7.5.13 SHOW CREATE VIEW Statement
https://dev.mysql.com/doc/refman/5.7/en/show-create-view.html
SHOW CREATE VIEW view_name
13.7.5.14 SHOW DATABASES Statement
SHOW {DATABASES | SCHEMAS} [LIKE 'pattern' | WHERE expr]
SHOW DATABASES
SHOW DATABASES lists the databases on the MySQL server host. SHOW SCHEMAS is a synonym for SHOW DATABASES. The LIKE clause, if present, indicates which database names to match.
SHOW DATABASES列出了MySQL服务器主机上的数据库。 SHOW SCHEMAS是SHOW DATABASES的同义词。 LIKE子句(如果存在)指示要匹配的数据库名称。