MySQL内置help解析

这篇文章主要讲解了“MySQL内置help解析”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“MySQL内置help解析”吧!

 1,登录MySQL,询问系统内置说明书

root@db02 scripts]# mysql -uroot -S /data/3306/mysql.sock 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.36 Source distribution
Copyright (c) 2000, 2017, 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.
mysql> ? contents  ##我们不知道怎么用,就问系统,你都有什么内容,下面就是它反馈给你的内容
Account Management      ##账户管理
Administration		###管理
Compound Statements     ##复合语句
Data Definition 	##数据定义
Data Manipulation	##数据操作
Data Types	        ##数据类型
Functions		##功能
Functions and Modifiers for Use with GROUP BY  ##与组一起使用的函数和修饰符
Geographic Features     ##地理特征
Help Metadata 		##帮助元数据
Language Structure 	##语言结构
Plugins 		##插件
Procedures 		##程序
Storage Engines 	##存储引擎
Table Maintenance       ##表维护
Transactions  		##交易
User-Defined Functions  ##用户定义的函数
Utility  		##效用

2,我们按照它给的说明书,进行下面的询问

  1)例如:我们想新建1个数据库,怎么找到语法呢?

mysql> ?  Data Definition  #查看了上面的说明书,应该在数据如何定义这里面,所以?问号它;
You asked for help about help category: "Data Definition"
For more information, type 'help <item>', where <item> is one of the following
topics:
   CREATE DATABASE
   CREATE EVENT
   CREATE FUNCTION
   CREATE INDEX
   CREATE LOGFILE GROUP
   CREATE PROCEDURE
   CREATE SERVER
   CREATE TABLE
   CREATE TABLESPACE
   CREATE TRIGGER
   .....若干省略选项

2)通过上面 就找到了 CREATE DATABASE 选项,但我还是不会建立数据库啊,那继续问吧

mysql> ? CREATE DATABASE
Name: 'CREATE DATABASE'
Description:
Syntax:
CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name  #这次就找到新建数据库的语法了,直接创建即可
    [create_specification] ...    ##需要注意{}大括号多选1,[]可选可忽略,其它必选
create_specification:
    [DEFAULT] CHARACTER SET [=] charset_name
  | [DEFAULT] COLLATE [=] collation_name
CREATE DATABASE creates a database with the given name. To use this
statement, you need the CREATE privilege for the database. CREATE
SCHEMA is a synonym for CREATE DATABASE.
URL: http://dev.mysql.com/doc/refman/5.6/en/create-database.html

3)下面就是根据系统提示的语法,新建一个qiuyuetao的数据库

mysql> create database qiuyuetao;
Query OK, 1 row affected (0.05 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| qiuyuetao          |
| test               |
+--------------------+
5 rows in set (0.07 sec)

3,SQL语句分为3类

    1)DDL :数据定义的语言,可?Data Definition去查询

 create、alter、drop,管理基础数据:例如 库,表

    2)DCL:Data control Language-数据控制语言

 grant、revoke、commit,rollback,用户授权,权限回收,数据提交回滚

   3)DML:Date Manipulation Language-数据操作语言

  select、update、delete、insert,对表与记录 做操作

感谢各位的阅读,以上就是“MySQL内置help解析”的内容了,经过本文的学习后,相信大家对MySQL内置help解析这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!