MYSQL: MYSQL command line instructions

Source: Internet
Author: User
Tags mysql commands rehash
MYSQL Getting started: MYSQL command line commands that can be used to describe bitsCN.com

MYSQL Quick start: MYSQL command line instructions

Related links:

MYSQL: Basic operations

Http: // database/201212/173868 .html

MYSQL 2: use regular expressions to search

Http: // database/201212/173869 .html

MYSQL 3: full text search

Http: // database/201212/173873 .html

MYSQL entry 4: MYSQL data types

Http: // database/201212/175536 .html

MYSQL entry 5: MYSQL character set

Http: // database/201212/175541 .html

MYSQL getting started 6: MYSQL operators

Http: // database/201212/175862 .html

MYSQL entry 7: MYSQL common functions

Http: // database/201212/175864 .html

Step 8: basic database and table operations

Http: // database/201212/175867 .html

MYSQL entry 9: simple indexing operations

Http: // database/201212/176772 .html

MYSQL Getting started: Basic View operations

Http: // database/201212/176775 .html

MYSQL getting started 11: basic trigger operations

Http: // database/201212/176781 .html

MYSQL entry 12: basic operations of stored procedures

Http: // database/201212/177380 .html

Step 13: basic operations of user-defined functions

Http: // database/201212/177382 .html

MYSQL tutorial 14: basic operations on cursors

Http: // database/201212/177384 .html

MYSQL basics: basic operations for transaction processing

Http: // database/201212/177385 .html

MYSQL Getting started: MYSQL command parameters

Http: // database/201212/178079 .html

In the MYSQL command line, some very practical small commands can be used.

After you run the MYSQL command line, enter/h to view the small commands supported by the MYSQL command line and their function descriptions:

[SQL]

Mysql>/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 Network 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 command.

Connect (/r) Reconnect to the server. Optional arguments are db and host.

Delimiter (/d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.

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.

Notee (/t) Don't write into outfile.

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.

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.

For server side help, type 'help contents'

The output contains two parts:

The first part is the MYSQL client-related small commands. the corresponding Chinese translation is as follows:

? (/?) Displays help information. Same as/h

Clear (/c) does not execute the command currently being input. If the command separator is included before/c, the part before the command separator is still executed.

Connect (/r) to the server again. The command has two parameters: database name and server host name. the host name can be omitted.

Delimiter (/d) modify command separator

Ego (/G) displays command results in vertical form

Exit (/q) quit

Go (/g) sends commands to the server. It can be used at the end of the statement to replace the command separator.

Help (/h) displays help information. And /? Same functions

Do not write notee (/t) into OUTFILE

Print (/p) displays the currently executed command

Prompt (/R) modify MYSQL prompt

Quit (/q) quit

Rehash (/#)

Source (/.) executes the SQL script in the parameter file

Status (/s) to get the server status

Tee (/T) specifies an output file to record all operations and results in the command line to this file

Use (/u) to convert the currently used database

Charset (/C) converts the character set of the current connection and client

Warnings (/W) displays warning information

Example of nowarning (/w) not displaying warning information:

[SQL]

Mysql> select count (*) from newname/c

Mysql> select count (*) from newname;/c

+ ---------- +

| Count (*) |

+ ---------- +

| 1, 159 |

+ ---------- +

Mysql>/R this is mysql5>

PROMPT set to 'this is mysql5>'

This is mysql5>/. h:/select. SQL

+ ---------- +

| Count (*) |

+ ---------- +

| 1, 159 |

+ ---------- +

This is mysql5>/s

--------------

Mysql Ver 14.14 Distrib 5.1.28-rc, for Win32 (ia32)

Connection id: 25

Current database: test

Current user: root @ localhost

SSL: Not in use

Using delimiter :;

Server version: 5.1.28-rc-community MySQL Community Server (GPL)

Protocol version: 10

Connection: localhost via TCP/IP

Server characterset: latin1

Db characterset: latin1

Client characterset: gbk

Conn. characterset: gbk

TCP port: 3306

Uptime: 1 hour 29 min 31 sec

Threads: 1 Questions: 55 Slow queries: 0 Opens: 24 Flush tables: 1 Open tables: 5 Queries per second avg: 0.10

--------------

This is mysql5>/T h:/a.txt

Logging to file 'H:/a.txt'

This is mysql5>/q

Bye

The second part is the command for viewing MYSQL server-related information. you can use help contents to view its usage:

[SQL]

Mysql> help contents

You asked for help about help category: "Contents"

For more information, type 'help ', Where Is one of the following

Categories:

Account Management

Administration

Data Definition

Data Manipulation

Data Types

Functions

Functions and Modifiers for Use with GROUP

Geographic Features

Language Structure

Plugins

Storage Engines

Stored Routines

Table Maintenance

Transactions

Triggers

You can still use help to view the results of some help commands. For example, the result of help Data Types is as follows:

[SQL]

Mysql> help Data Types

You asked for help about help category: "Data Types"

For more information, type 'help ', Where 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

You can still use help INT to view the details of the INT data type:

[SQL]

Mysql> help INT

Name: 'int'

Description:

INT [(M)] [UNSIGNED] [ZEROFILL]

A normal-size integer. The signed range is-2147483648 to 2147483647.

The unsigned range is 0 to 4294967295.

URL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html

The result shows the usage of the INT type and the data range that the INT type can represent.

BitsCN.com

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.