Mysql 中完善的帮助命令

Mysql 中的帮助系统很完善,很多操作都可以通过命令行直接获得帮助,如下示例:

Mysql 命令行帮助

[root@mysql1 mydata1]# mysql -S /u01/mytmp/mysql.sock1
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 97
Server version: 8.0.16 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@(none):35: >\h

For information about MySQL products and services, visit:
  http://www.mysql.com/
For developer information, including the MySQL Reference Manual, visit:
  http://dev.mysql.com/
To buy MySQL Enterprise support, training, or other products, visit:
  https://shop.mysql.com/

List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
?         (\?) Synonym for `help'.
clear     (\c) Clear the current input statement.
connect   (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit      (\e) Edit command with $EDITOR.
ego       (\G) Send command to mysql server, display result vertically.
exit      (\q) Exit mysql. Same as quit.
go        (\g) Send command to mysql server.
help      (\h) Display this help.
nopager   (\n) Disable pager, print to stdout.
notee     (\t) Don't write into outfile.
pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print     (\p) Print current command.
prompt    (\R) Change your mysql prompt.
quit      (\q) Quit mysql.
rehash    (\#) Rebuild completion hash.
source    (\.) Execute an SQL script file. Takes a file name as an argument.
status    (\s) Get status information from the server.
system    (\!) Execute a system shell command.
tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.
use       (\u) Use another database. Takes database name as argument.
charset   (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings  (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.
resetconnection(\x) Clean session context.

For server side help, type 'help contents'

Mysql 帮助清单

root@(none):35: >select * from mysql.help_category;
+------------------+-----------------------------------------------+--------------------+-----+
| help_category_id | name                                          | parent_category_id | url |
+------------------+-----------------------------------------------+--------------------+-----+
|                1 | Account Management                            |                  7 |     |
|                2 | Administration                                |                  7 |     |
|                3 | Bit Functions                                 |                 14 |     |
|                4 | Comparison operators                          |                 14 |     |
|                5 | Components                                    |                  7 |     |
|                6 | Compound Statements                           |                  7 |     |
|                7 | Contents                                      |                  0 |     |
|                8 | Control flow functions                        |                 14 |     |
|                9 | Data Definition                               |                  7 |     |
|               10 | Data Manipulation                             |                  7 |     |
|               11 | Data Types                                    |                  7 |     |
|               12 | Date and Time Functions                       |                 14 |     |
|               13 | Encryption Functions                          |                 14 |     |
|               14 | Functions                                     |                  7 |     |
|               15 | Functions and Modifiers for Use with GROUP BY |                  7 |     |
|               16 | Geographic                                    |                  0 |     |
|               17 | Geographic Features                           |                  7 |     |
|               18 | Geometry constructors                         |                 17 |     |
|               19 | Geometry properties                           |                 17 |     |
|               20 | Geometry relations                            |                 17 |     |
|               21 | GeometryCollection properties                 |                 16 |     |
|               22 | Help Metadata                                 |                  7 |     |
|               23 | Information Functions                         |                 14 |     |
|               24 | Language Structure                            |                  7 |     |
|               25 | LineString properties                         |                 17 |     |
|               26 | Locking Functions                             |                 14 |     |
|               27 | Logical operators                             |                 14 |     |
|               28 | MBR                                           |                 17 |     |
|               29 | Miscellaneous Functions                       |                 14 |     |
|               30 | Numeric Functions                             |                 14 |     |
|               31 | Plugins                                       |                  7 |     |
|               32 | Point properties                              |                 17 |     |
|               33 | Polygon properties                            |                 17 |     |
|               34 | Storage Engines                               |                  7 |     |
|               35 | String Functions                              |                 14 |     |
|               36 | Table Maintenance                             |                  7 |     |
|               37 | Transactions                                  |                  7 |     |
|               38 | User-Defined Functions                        |                  7 |     |
|               39 | Utility                                       |                  7 |     |
|               40 | WKB                                           |                 17 |     |
|               41 | WKT                                           |                 17 |     |
+------------------+-----------------------------------------------+--------------------+-----+
41 rows in set (0.00 sec)

帮助案例

root@(none):38: >help Help Metadata
You asked for help about help category: "Help Metadata"
For more information, type 'help <item>', where <item> is one of the following
topics:
  HELP_DATE
  HELP_VERSION

root@(none):39: >help HELP_DATE
Name: 'HELP_DATE'
Description:
This help information was generated from the MySQL 8.0 Reference Manual
on: 2019-02-20

root@(none):39: >help HELP_VERSION
Name: 'HELP_VERSION'
Description:
This help information was generated from the MySQL 8.0 Reference Manual
on: 2019-02-20 (revision: 61006)

This information applies to MySQL 8.0 through 8.0.17.

查看支持的数据类型

root@(none):39: >help Data Types 
You asked for help about help category: "Data Types"
For more information, type 'help <item>', where <item> is one of the following
topics:
  AUTO_INCREMENT
  BIGINT
  BINARY
  BIT
  BLOB
  BLOB DATA TYPE
  BOOLEAN
  CHAR
  CHAR BYTE
  DATE
  DATETIME
  DEC
  DECIMAL
  DOUBLE
  DOUBLE PRECISION
  ENUM
  FLOAT
  INT
  INTEGER
  LONGBLOB
  LONGTEXT
  MEDIUMBLOB
  MEDIUMINT
  MEDIUMTEXT
  SET DATA TYPE
  SMALLINT
  TEXT
  TIME
  TIMESTAMP
  TINYBLOB
  TINYINT
  TINYTEXT
  VARBINARY
  VARCHAR
  YEAR DATA TYPE

root@(none):41: >help AUTO_INCREMENT
Name: 'AUTO_INCREMENT'
Description:
The AUTO_INCREMENT attribute can be used to generate a unique identity
for new rows:

URL: http://dev.mysql.com/doc/refman/8.0/en/example-auto-increment.html

Examples:
CREATE TABLE animals (
    id MEDIUMINT NOT NULL AUTO_INCREMENT,
    name CHAR(30) NOT NULL,
    PRIMARY KEY (id)
);

INSERT INTO animals (name) VALUES
   ('dog'),('cat'),('penguin'),
   ('lax'),('whale'),('ostrich');

SELECT * FROM animals;

root@(none):41: >help DATE
Name: 'DATE'
Description:
DATE

A date. The supported range is '1000-01-01' to '9999-12-31'. MySQL
displays DATE values in 'YYYY-MM-DD' format, but permits assignment of
values to DATE columns using either strings or numbers.

URL: http://dev.mysql.com/doc/refman/8.0/en/date-and-time-type-overview.html


root@(none):42: >help DATETIME
Name: 'DATETIME'
Description:
DATETIME[(fsp)]

A date and time combination. The supported range is '1000-01-01
00:00:00.000000' to '9999-12-31 23:59:59.999999'. MySQL displays
DATETIME values in 'YYYY-MM-DD HH:MM:SS[.fraction]' format, but permits
assignment of values to DATETIME columns using either strings or
numbers.

An optional fsp value in the range from 0 to 6 may be given to specify
fractional seconds precision. A value of 0 signifies that there is no
fractional part. If omitted, the default precision is 0.

Automatic initialization and updating to the current date and time for
DATETIME columns can be specified using DEFAULT and ON UPDATE column
definition clauses, as described in
http://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html.

URL: http://dev.mysql.com/doc/refman/8.0/en/date-and-time-type-overview.html


root@(none):42: >help TIMESTAMP
Name: 'TIMESTAMP'
Description:
TIMESTAMP[(fsp)]

A timestamp. The range is '1970-01-01 00:00:01.000000' UTC to
'2038-01-19 03:14:07.999999' UTC. TIMESTAMP values are stored as the
number of seconds since the epoch ('1970-01-01 00:00:00' UTC). A
TIMESTAMP cannot represent the value '1970-01-01 00:00:00' because that
is equivalent to 0 seconds from the epoch and the value 0 is reserved
for representing '0000-00-00 00:00:00', the "zero" TIMESTAMP value.

An optional fsp value in the range from 0 to 6 may be given to specify
fractional seconds precision. A value of 0 signifies that there is no
fractional part. If omitted, the default precision is 0.

The way the server handles TIMESTAMP definitions depends on the value
of the explicit_defaults_for_timestamp system variable (see
http://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html).

If explicit_defaults_for_timestamp is enabled, there is no automatic
assignment of the DEFAULT CURRENT_TIMESTAMP or ON UPDATE
CURRENT_TIMESTAMP attributes to any TIMESTAMP column. They must be
included explicitly in the column definition. Also, any TIMESTAMP not
explicitly declared as NOT NULL permits NULL values.

If explicit_defaults_for_timestamp is disabled, the server handles
TIMESTAMP as follows:

Unless specified otherwise, the first TIMESTAMP column in a table is
defined to be automatically set to the date and time of the most recent
modification if not explicitly assigned a value. This makes TIMESTAMP
useful for recording the timestamp of an INSERT or UPDATE operation.
You can also set any TIMESTAMP column to the current date and time by
assigning it a NULL value, unless it has been defined with the NULL
attribute to permit NULL values.

Automatic initialization and updating to the current date and time can
be specified using DEFAULT CURRENT_TIMESTAMP and ON UPDATE
CURRENT_TIMESTAMP column definition clauses. By default, the first
TIMESTAMP column has these properties, as previously noted. However,
any TIMESTAMP column in a table can be defined to have these
properties.

URL: http://dev.mysql.com/doc/refman/8.0/en/date-and-time-type-overview.html


root@(none):42: >

Mysql 中完善的帮助命令的更多相关文章

  1. MySQL中使用SHOW PROFILE命令分析性能的用法整理(配合explain效果更好,可以作为优化周期性检查)

    这篇文章主要介绍了MySQL中使用show profile命令分析性能的用法整理,show profiles是数据库性能优化的常用命令,需要的朋友可以参考下   show profile是由Jerem ...

  2. MySQL中的binlog相关命令和恢复技巧

    操作命令: 复制代码 代码如下: show binlog events in 'mysql-bin.000016' limit 10; reset master 删除所有的二进制日志 flush lo ...

  3. mysql 中启动服务的命令 、登录命令、退出命令 mysql 的常用命令

    1.cmd 以管理员执行 下面命令 启动服务 :net start mysql57 关闭 服务:net stop mysql57 查看mysql 的版本信息 : mysql -V 指定主机地址登录: ...

  4. MySQL中使用SHOW PROFILE命令分析性能的用法整理

    show profile是由Jeremy Cole捐献给MySQL社区版本的.默认的是关闭的,但是会话级别可以开启这个功能.开启它可以让MySQL收集在执行语句的时候所使用的资源.为了统计报表,把pr ...

  5. 使用MySQL中的EXPLAIN解释命令来检查SQL

    我们看到许多客户的系统因为SQL及数据库设计的很差所以导致许多性能上的问题,这些问题不好解决,但是可以采用一套简单的策略来检查生产系统,发现并纠正一些共性问题. 很显然,您应该尽最大努力设计出最好的数 ...

  6. 转 MySQL中的行级锁,表级锁,页级锁

      对mysql乐观锁.悲观锁.共享锁.排它锁.行锁.表锁概念的理解 转载. https://blog.csdn.net/puhaiyang/article/details/72284702 实验环境 ...

  7. mysql 中常用的 sql 语句

    SQL分类: DDL-----数据定义语言(CREATE--创建,ALTER--修改. DROP--删除表,DECLARE--声明) DML-----数据定义语言(SELECT--查询,DELECT- ...

  8. Mysql中mysqldump命令使用详解

    MySQL有很多可以导入数据的方法,然而这些只是数据传输中的一半,另外的一般是从MySQL数据库中导出数据.有许多的原因我们需要导出数据.一个重要的原因是用于备份数据库.数据的造价常常是昂贵的,需要谨 ...

  9. MYSQL存储过程中常使用的命令记录

    MYSQL存储过程中常使用的命令记录 1.触发器trigger 查看:show triggers; 2.存储过程procedure 查看:show procedure status; 查看详细:sho ...

随机推荐

  1. 宣化上人:大佛顶首楞严经四种清净明诲浅释(2-3) -------------------------------------------------------------------------------- (转自学佛网:http://www.xuefo.net/nr/article23/230612.html)

    大佛顶首楞严经四种清净明诲浅释(2-3) 唐天竺·沙门般剌密帝译 宣化上人主讲 一九八三年四月十七日晚讲于万佛圣城 欲摄其心入三摩地:这种邪师说法,在末法的时候像恒河沙这么多:可是我想在这时候,令一切 ...

  2. 【docker 使用】创建镜像docker build

    创建镜像命令 docker build -t [镜像name]:[镜像tag] -f [dockerfile路径] [资源目录] 执行该命令后,docker会将[资源目录]打包,之后在dockerfi ...

  3. win10安装MySQL 8

    下载并解压MySQL Server(官方有MySQL Installer 8.0.13,但是我安装没有成功) 将MySQL Server的bin目录加入到系统变量Path中. 找一个my.ini文件放 ...

  4. Navicat Premium教程

    介绍 Navicat premium是一款数据库管理工具,是一个可多重连线资料库的管理工具,它可以让你以单一程式同时连线到 MySQL.SQLite.Oracle 及 PostgreSQL 资料库,让 ...

  5. Python常见的异常

    Python中常见的异常如表所示. exception的更多用法: 1.通常else 语句只有在没有异常的情况下才会被执行 try: aa = "异常测试:" print(aa)e ...

  6. 【计算机视觉】车牌识别开源框架EasyPR介绍

    之前学习了一个GitHub开源的框架,GitHub地址为: https://github.com/liuruoze/EasyPR  希望通过此篇博客详细阐述如何一步步实现车牌的识别过程.  车牌识别分 ...

  7. mysql查看正在运行的语句

    mysql查看正在运行的语句 并且查看运行最多的mysql语句 MySQL 打开 general log 后,所有的查询语句都会记录在 general log 文件,文件为只读方式,但这样genera ...

  8. win10卸载office2010的工具

    本来想装一个高版本的office,于是想先卸载老版本的.结果在win10的应用和功能中,愣是没找到安装的office2010,使用360也找不到,没法卸载. 网上搜了一下,找到一个好工具,micros ...

  9. SVN增加访问用户

    1.在Linux中进入SVN配置文件目录. 2.authz是设置权限的,只读还是可读可写,passwd是增加访问用户的. vim passwd; vim authz;

  10. Java的设计模式(5)-- 策略模式

    定义一系列算法,把它们一个个封装起来,并且使它们可以相互替换,本模式使得算法可以独立于使用它的客户而变化.策略模式包括以下三种角色 策略(Strategy):策略是一个接口,该接口定义若干个算法标识, ...