If you are just getting started in the MySQL database, it can be challenging to remember all the available features, commands, functions, data types, and more. However, thanks to a simple MySQL command, you do not have to memorize any of these.
This article will show you how to use the HELP command in MySQL which allows you to fetch the documentation in the MySQL reference manual from the command line.
Let’s jump in and explore.
MySQL Help Statement
The HELP command accepts a search string on which to retrieve the relevant documentation. The command then fetches the results for the specified string.
The command syntax is shown in the following:
The specified search string is case-insensitive.
You can also specify the wildcard characters such as % and _. The command performs a similar action as defined in the LIKE operator.
Step 1: Initialize MySQL Help Table
Before we can use the HELP command, we need to initialize the help table. First, follow the commands provided in the following:
Start by downloading the MySQL help table file as shown in the following request:
Next, login into your MySQL server and load the downloaded sql file. The command is as shown:
The previous command loads the help table in the MySQL database with all the necessary information.
Keep in mind that this process is not necessary for Windows systems.
MySQL Show Top-Level Categories
We can use the HELP command followed by the string “contents” to show the list of the top-level categories:
The command should return an output as follows:
For more information, type 'help <item>', where <item> is one of the following
categories:
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
Table Maintenance
Transactions
User-Defined Functions
Utility
MySQL Show Help on Sub-Categories
Once you locate the category that you wish to retrieve the help, you can explore further with the following syntax:
Running the previous command should return the detailed information about the plugin’s commands.
Name: 'SHOW PLUGINS'
Description:
Syntax:
SHOW PLUGINS
SHOW PLUGINS displays information about server plugins. Plugin
information is also available in the INFORMATION_SCHEMA.PLUGINS table.
See http://dev.mysql.com/doc/refman/5.5/en/plugins-table.html.
Example of SHOW PLUGINS output:
<strong>***************************</strong> 1. row<strong> ***************************</strong>
Name: binlog
Status: ACTIVE
Type: STORAGE ENGINE
Library: NULL
License: GPL
<strong>**************************</strong>* 2. row *<strong>**************************</strong>
Name: CSV
Status: ACTIVE
Type: STORAGE ENGINE
Library: NULL
License: GPL
MySQL Show Help on Specific Commands
You can also retrieve help on specific commands as shown in the following example:
Running the previous command returns the comprehensive information about the select keyword:
Description:
Syntax:
SELECT
[ALL | DISTINCT | DISTINCTROW ]
[HIGH_PRIORITY]
[STRAIGHT_JOIN]
-------------OUTPUT TRUNCATED-------------------
Conclusion
This tutorial introduces you to the help command in MySQL which allows you to fetch the command help without using an online documentation. Feel free to explore the command further.
Thanks for reading!