How to obtain MySQL help information

Source: Internet
Author: User
Tags close page mysql commands

How to obtain MySQL help information

When a MySQL-related fault occurs in the development or test environment, most of my friends may post on the Forum and discuss the problem with the QQ group. This method is one of the effective ways to get help. However, in a production environment without a network, these methods will not help solve the problem. Regardless of the database, obtaining help from the official website is the most direct and effective way. In the absence of a network environment, we can solve the problem through the help information provided by the MySQL client tool.

1) MySQL official manual

And Oracle official documentation, MySQL official manual is the most direct and effective way to get MySQL help. This Manual contains many parts, such as SQL syntax, MySQL installation method, MySQL System variables, status variables, common tools for command line, and database management. In short, it is a large collection of MySQL Data. Supports PDF and html downloads.

Download location: http://dev.mysql.com/doc/

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

MySQL-5.5.38 universal binary Installation

-------------------------------------- Split line --------------------------------------

2) MySQL client tool's built-in help

Obtain mysql-related help information. Enter help at the mysql prompt to obtain help information about the mysql client.
This method is similar to help in Oracle SQL * plus.
Mysql> help

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 ';'
? (\?) Synonym for 'help '.
Clear (\ c) Clear the current input statement. -- clear the current input statement
Connect (\ r) Reconnect to the server. optional arguments are db and host. -- reconnect, which is usually used for disconnection after removal or exception disconnection. This connect command is also available in SQL * plus.
Delimiter (\ d) Set statement delimiter. -- Set the command Terminator. The default value is; for example, we can Set it to/to indicate the statement ends.
Edit (\ e) Edit command with $ EDITOR. -- edit the previous SQL statement of the buffer to the file. By default, vi is called and the file is placed in the/tmp path.
Ego (\ G) Send command to mysql server, display result vertically. -- The control result is displayed vertically.
Exit (\ q) Exit mysql. Same as quit. -- exit mysql
Go (\ g) Send command to mysql server. -- Send command to mysql Service
Help (\ h) Display this help.
Nopager (\ n) Disable pager, print to stdout. -- close page settings and print to standard output
Notee (\ t) Don't write into outfile. -- disable output to file
Pager (\ P) Set PAGER [to_pager]. Print the query results via PAGER. -- Set the pager mode, which can be Set to call more, less, and so on. It is mainly used for paging display.
Print (\ p) Print current command.
Prompt (\ R) Change your mysql prompt. -- Change the mysql prompt
Quit (\ q) Quit mysql.
Rehash (#) Rebuild completion hash. -- auto-complete related object names
Source (\.) Execute an SQL script file. Takes a file name as an argument. -- Execute the script file
Status (\ s) Get status information from the server. -- Get status information
System (\!) Execute a system shell command. -- Execute system commands
Tee (\ T) Set outfile [to_outfile]. Append everything into given outfile. -- the operation result is output to the file.
Use (\ u) Use another database. Takes database name as argument. -- switch database
Charset (\ C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets. -- set the character set
Warnings (\ W) Show warnings after every statement. -- print warning information
Nowarning (\ w) Don't show warnings after every statement.
-- For all the commands above, the extension is a shortcut operation, that is, you only need to enter "\" + letters to execute

For server side help, type 'help CONTENTS' -- note that the help contents description here will receive help information from the server.

-- Demo section: Common commands
-- Connect command
Mysql> connect chardb localhost;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-

Connection id: 5
Current database: chardb

-- Set pagination. When a page is displayed, the page appears repeatedly. You can use this command to set pagination to call system commands.
Mysql> pager more -- set to more
PAGER set to 'more'
Mysql> select table_name, table_type, engine from information_schema.tables;
Mysql> pager tail-5; -- set the output tail to 5 rows
PAGER set to 'Tail-5'
Mysql> select table_name, table_type, engine from information_schema.tables;
| Setup_timers | base table | PERFORMANCE_SCHEMA |
| Threads | base table | PERFORMANCE_SCHEMA |
| Animals | base table | InnoDB |
| Shop | base table | InnoDB |
+ -------------------------------------------- + ------------- + ---------------------- +
92 rows in set (0.02 sec)

Mysql> pager; -- view the current pager settings
PAGER set to 'Tail-5'
Mysql> nopager; -- switch to standard (default) pager Mode
PAGER set to stdout

-- Tee command to output log files
Mysql> tee/tmp/query. log -- enable output to a file, which is equivalent to spool in SQL * plus.
Logging to file '/tmp/query. Log'
Mysql> select table_name, table_type, engine from information_schema.tables;
+ -------------------------------------------- + ------------- + ---------------------- +
| Table_name | table_type | engine |
+ -------------------------------------------- + ------------- + ---------------------- +
| CHARACTER_SETS | system view | MEMORY |
| COLLATIONS | system view | MEMORY |
.............
Mysql> notee; -- close output to file, equivalent to spool off under SQL * Plus
Outfile disabled.
Mysql> system tail/tmp/query. log -- view the output log File
| Setup_consumers | base table | PERFORMANCE_SCHEMA |
| Setup_instruments | base table | PERFORMANCE_SCHEMA |
| Setup_timers | base table | PERFORMANCE_SCHEMA |
| Threads | base table | PERFORMANCE_SCHEMA |
| Animals | base table | InnoDB |
| Shop | base table | InnoDB |
+ -------------------------------------------- + ------------- + ---------------------- +
92 rows in set (0.02 sec)

-- Change mysql prompt
Mysql> prompt SessionA>
PROMPT set to 'sessiona>'

-- Restore to the default prompt
SessionA> prompt;
Returning to default PROMPT of mysql>

-- Execute the SQL script file
Mysql> system more query. SQL -- note that the current directory is
Use chardb
Select * from tb_isam;
Mysql> source query. SQL
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-

Database changed
+ ------ + ------- +
| Id | value |
+ ------ + ------- +
| 1 | a |
| 2 | B |
| 3 | c |
| 4 | f |
+ ------ + ------- +
4 rows in set (0.00 sec)

-- Get status information
Mysql> status;
--------------
Mysql Ver 14.14 Distrib 5.5.37, for Linux (x86_64) using readline 5.1

Connection id: 6
Current database: chardb
Current user: root @ localhost
SSL: Not in use
Current pager: less
Using outfile :''
Using delimiter :;
Server version: 5.5.37-log MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: utf8
Client characterset: latin1
Conn. characterset: latin1
UNIX socket:/var/lib/mysql. sock
Uptime: 3 hours 10 min 59 sec

Threads: 1 Questions: 97 Slow queries: 0 Opens: 313 Flush tables: 1 Open tables: 51 Queries per second avg: 0.008
--------------

-- Modify the client Character Set
Mysql> charset gbk;
Charset changed
Mysql> \ s
--------------
Mysql Ver 14.14 Distrib 5.5.37, for Linux (x86_64) using readline 5.1

Connection id: 6
Current database: chardb
Current user: root @ localhost
SSL: Not in use
Current pager: less
Using outfile :''
Using delimiter :;
Server version: 5.5.37-log MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: utf8
Client characterset: gbk --- both the Client and conn character sets are changed to gbk.
Conn. characterset: gbk
UNIX socket:/var/lib/mysql. sock
Uptime: 3 hours 13 min 33 sec

Threads: 1 Questions: 105 Slow queries: 0 Opens: 313 Flush tables: 1 Open tables: 51 Queries per second avg: 0.009
--------------

Mysql> warnings;
Show warnings enabled.
Mysql> selecs 1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selecs 1' at line 1
Mysql> show warnings;
+ ------- + ------ + Response ----------------------------- +
| Level | Code | Message |
+ ------- + ------ + Response ----------------------------- +
| Error | 1064 | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selecs 1' at line 1 |
+ ------- + ------ + Response ----------------------------- +
1 row in set (0.00 sec)

Mysql> show errors;
+ ------- + ------ + Response ----------------------------- +
| Level | Code | Message |
+ ------- + ------ + Response ----------------------------- +
| Error | 1064 | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selecs 1' at line 1 |
+ ------- + ------ + Response ----------------------------- +
1 row in set (0.00 sec)

Mysql> nowarning;
Show warnings disabled.

3. Server-related help

-- Get help related to server management and enter 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
Compound Statements
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP
Geographic Features
Help Metadata
Language Structure
Plugins
Procedures
Storage Engines
Table Maintenance
Transactions
User-Defined Functions
Utility

-- To query the content of that part, enter help + directly, as shown below:
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
FLUSH QUERY CACHE
HELP COMMAND
KILL
..........

-- Next, let's check the flush command usage in the administration Section and directly enter help flush ;.
Mysql> help flush;
Name: 'flush'
Description:
Syntax:
FLUSH [NO_WRITE_TO_BINLOG | LOCAL]
Flush_option [, flush_option]...

The FLUSH statement has several variant forms that clear or reload
Various internal caches, flush tables, or acquire locks. To execute
FLUSH, you must have the RELOAD privilege. Specific flush options might
Require additional privileges, as described later.

-- View the help information of the cache index
Mysql> help cache index;
Name: 'cache Index'
Description:
Syntax:
CACHE INDEX
Tbl_index_list [, tbl_index_list]...
[PARTITION (partition_list | ALL)]
IN key_cache_name

Tbl_index_list:
Tbl_name [[INDEX | KEY] (index_name [, index_name]...)]

Partition_list:
Partition_name [, partition_name] [,...]
........................

-- Summary: You can obtain detailed information related to the topic through step-by-step help.
-- Author: Leshami -- Blog: l

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.