Home Database Mysql Tutorial MYSQL入门学习之十七:MYSQL命令行内可使用的命令详细说明_MySQL

MYSQL入门学习之十七:MYSQL命令行内可使用的命令详细说明_MySQL

Jun 01, 2016 pm 01:37 PM
database expression

bitsCN.com

MYSQL入门学习之十七:MYSQL命令行内可使用的命令详细说明

 

相关链接:

MYSQL入门学习之一:基本操作

http:///database/201212/173868.html

MYSQL入门学习之二:使用正则表达式搜索

http:///database/201212/173869.html

MYSQL入门学习之三:全文本搜索

http:///database/201212/173873.html

MYSQL入门学习之四:MYSQL的数据类型

http:///database/201212/175536.html

MYSQL入门学习之五:MYSQL的字符集

http:///database/201212/175541.html

MYSQL入门学习之六:MYSQL的运算符

http:///database/201212/175862.html

MYSQL入门学习之七:MYSQL常用函数

http:///database/201212/175864.html

MYSQL入门学习之八:数据库及表的基本操作

http:///database/201212/175867.html

MYSQL入门学习之九:索引的简单操作

http:///database/201212/176772.html

MYSQL入门学习之十:视图的基本操作

http:///database/201212/176775.html

MYSQL入门学习之十一:触发器的基本操作

http:///database/201212/176781.html

MYSQL入门学习之十二:存储过程的基本操作

http:///database/201212/177380.html

MYSQL入门学习之十三:自定义函数的基本操作

http:///database/201212/177382.html

MYSQL入门学习之十四:游标的基本操作

http:///database/201212/177384.html

MYSQL入门学习之十五:事务处理的基本操作

http:///database/201212/177385.html

MYSQL入门学习之十六:MYSQL命令参数详解

http:///database/201212/178079.html

 

在MYSQL命令行中,有一些非常实用的小命令可以使用。

进行MYSQL命令行后,输入/h,可查看MYSQL命令行支持的小命令及对应的功能说明:

[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 with ';'  

?         (/?) 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'  

这段输出主要包含两部分信息:

第一部分为MYSQL客户端相关的小命令,其对应的中文翻译如下:

 

? (/?) 显示帮助信息。与/h的功能相同

clear (/c) 不执行当前正在输入的命令。若/c前已包含命令分隔符,则命令分隔符之前的部分仍然执行。

connect (/r) 重新连接到服务器。该命令有两个参数:数据库名和服务器主机名,其中主机名可省略。

delimiter (/d) 修改命令分隔符

ego (/G) 将命令的结果以垂直的形式显示

exit (/q) 退出

go (/g) 向服务器发送命令。在语句的最后使用,可替代命令分隔符。

help (/h) 显示帮助信息。与/?的功能相同

notee (/t) 不要写入OUTFILE

print (/p) 显示当前执行的命令

prompt (/R) 修改MYSQL的提示符

quit (/q) 退出

rehash (/#)

source (/.) 执行参数文件中的SQL脚本

status (/s) 获取服务器端状态

tee (/T) 指定一个输出文件,将命令行中的所有操作及结果记入此文件

use (/u) 转换当前使用的数据库

charset (/C) 转换当前connection及client的字符集

warnings (/W) 显示警告信息

nowarning (/w) 不显示警告信息 示例:

[sql] 

mysql> select count(*) from newname/c  

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

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

| count(*) |  

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

|      159 |  

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

  

mysql>/R this is mysql5 >  

PROMPT set to 'this is mysql5 >'  

this is mysql5 >/. h:/select.sql  

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

| count(*) |  

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

|      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  

第二部分为查看MYSQL服务端相关信息的命令,使用help contents可以查看其用法:

[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 BY  

   Geographic Features  

   Language Structure  

   Plugins  

   Storage Engines  

   Stored Routines  

   Table Maintenance  

   Transactions  

   Triggers  

对于某些help命令的结果,仍然可以使用help进行进一步的查看。如help Data Types的结果如下:

[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  

仍然可以使用help INT,查看INT数据类型的详细信息:

[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  

由结果可以查看INT类型的用法,以及INT数据类型能表示的数据范围。

 

bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve discuz database error How to solve discuz database error Nov 20, 2023 am 10:10 AM

The solutions to discuz database error are: 1. Check the database configuration; 2. Make sure the database server is running; 3. Check the database table status; 4. Back up the data; 5. Clear the cache; 6. Reinstall Discuz; 7. Check the server resources ; 8. Contact Discuz official support. Solving Discuz database errors requires starting from multiple aspects, gradually identifying the cause of the problem, and taking corresponding measures to repair it.

Leak reveals key specs of Intel Arrow Lake-U, -H, -HX and -S Leak reveals key specs of Intel Arrow Lake-U, -H, -HX and -S Jun 15, 2024 pm 09:49 PM

IntelArrowLakeisexpectedtobebasedonthesameprocessorarchitectureasLunarLake,meaningthatIntel'sbrandnewLionCoveperformancecoreswillbecombinedwiththeeconomicalSkymontefficiencycores.WhileLunarLakeisonlyavailableasava

Can't drop database 'database_name'; database doesn't exist - How to solve MySQL error: Can't drop database, database doesn't exist Can't drop database 'database_name'; database doesn't exist - How to solve MySQL error: Can't drop database, database doesn't exist Oct 05, 2023 am 11:46 AM

How to solve MySQL error: Unable to delete database, database does not exist Overview: MySQL is a commonly used relational database management system. When using MySQL, we often need to manage the database, including creating databases, deleting databases and other operations. However, when deleting a database, sometimes you will encounter the error message "Can'tdropdatabase'database_name';databasedoesn'texist", that is, you cannot delete it.

How to solve Python expression syntax errors? How to solve Python expression syntax errors? Jun 24, 2023 pm 05:04 PM

Python, as a high-level programming language, is easy to learn and use. Once you need to write a Python program, you will inevitably encounter syntax errors, and expression syntax errors are a common one. In this article, we will discuss how to resolve expression syntax errors in Python. Expression syntax errors are one of the most common errors in Python, and they are usually caused by incorrect usage of syntax or missing necessary components. In Python, expressions usually consist of numbers, strings, variables, and operators. most common

In C and C++, comma is used to separate expressions or statements In C and C++, comma is used to separate expressions or statements Sep 09, 2023 pm 05:33 PM

In C or C++, the comma "," has different uses. Here we will learn how to use them. Commas as operators. The comma operator is a binary operator that evaluates the first operand, discards the result, then evaluates the second operand and returns the value. The comma operator has the lowest precedence in C or C++. Example #include<stdio.h>intmain(){ intx=(50,60); inty=(func1(),func2());} Here 60 will be assigned to x. For the next statement, func1( will be executed first

Introduction to exponential function expressions in C language Introduction to exponential function expressions in C language Feb 18, 2024 pm 01:11 PM

Introduction to how to write exponential function expressions in C language and code examples What is an exponential function? The exponential function is a common type of function in mathematics. It can be expressed in the form of f(x)=a^x, where a is the base and x is the exponent. . Exponential functions are mainly used to describe exponential growth or exponential decay. Code example of exponential function In C language, we can use the pow() function in the math library to calculate the exponential function. The following is a sample program: #include

lambda expression in Java lambda expression in Java Jun 09, 2023 am 10:17 AM

Lambda expressions in Java With the release of Java 8, lambda expressions have become one of the most concerned and discussed topics among Java developers. Lambda expressions can simplify Java programmers' tedious writing methods, and can also improve the readability and maintainability of programs. In this article, we will take a deep dive into lambda expressions in Java and how they provide a simpler and more intuitive programming experience in Java code.

Loop over a collection using lambda expressions Loop over a collection using lambda expressions Feb 19, 2024 pm 07:32 PM

A lambda expression is an anonymous function that can be conveniently used to iterate over a collection. In this article, we will introduce how to use lambda expressions to iterate over collections, and provide specific code examples. In Python, the syntax format of a lambda expression is as follows: lambda parameter list: The parameter list of an expression lambda expression can contain one or more parameters, separated by commas. The expression is the return value of the lambda function. Let's look at a simple example below, assuming

See all articles