Skip to content

Instantly share code, notes, and snippets.

@takenoco82
Created November 17, 2018 07:38
Show Gist options
  • Save takenoco82/58393d7ee8e4b4cd3507bacef8f7be9c to your computer and use it in GitHub Desktop.
Save takenoco82/58393d7ee8e4b4cd3507bacef8f7be9c to your computer and use it in GitHub Desktop.
MySQLのヘルプの使い方

MySQLのヘルプの使い方

とりあえず最初のhelpを表示する

mysql> help

For information about MySQL products and services, visit:
   http://www.mysql.com/
...

-- help contents を入力しろと言われたので、そのとおりにする
For server side help, type 'help contents'

help contents でヘルプのカテゴリ一覧を表示する

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 -- データベースの管理や操作などはここに含まれる
   Components
   ...

help Administration を実行してみる

mysql> help Administration
You asked for help about help category: "Administration"
For more information, type 'help <item>', where <item> is one of the following
topics:
   BINLOG
   CACHE INDEX
   FLUSH
   ...
   SHOW COLUMNS -- テーブル定義を見るコマンドのヘルプ
   ...

help SHOW COLUMNS を実行してみる

mysql> help SHOW COLUMNS
Name: 'SHOW COLUMNS'
Description:
Syntax:
SHOW [EXTENDED] [FULL] {COLUMNS | FIELDS}
    {FROM | IN} tbl_name
    [{FROM | IN} db_name]
    [LIKE 'pattern' | WHERE expr]
...

ヘルプに書かれたとおりにコマンドを実行してみる

mysql> SHOW TABLES;
+-------------------+
| Tables_in_sandbox |
+-------------------+
| users             |
+-------------------+
1 row in set (0.00 sec)

mysql> SHOW COLUMNS FROM users;
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| id    | int(10)     | NO   | PRI | NULL    | auto_increment |
| name  | varchar(64) | NO   |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment