This is the Reference Manual for the MySQL Database System, version 8.0, through release 8.0.25. Differences between minor versions of MySQL 8.0 are noted in the present text with reference to release numbers (8.0.这是MySQL数据库系统8.0版到8.0.25版的参考手册。MySQL8.0次要版本之间的差异在本文中提到了版本号(8.0.x)。x
). For license information, see the Legal Notices.有关许可证信息,请参阅法律声明。
This manual is not intended for use with older versions of the MySQL software due to the many functional and other differences between MySQL 8.0 and previous versions. 由于MySQL8.0与以前版本在功能和其他方面存在许多差异,因此本手册不适用于较旧版本的MySQL软件。If you are using an earlier release of the MySQL software, please refer to the appropriate manual. 如果您使用的是MySQL软件的早期版本,请参阅相应的手册。For example, MySQL 5.7 Reference Manual covers the 5.7 series of MySQL software releases.例如,MySQL 5.7参考手册涵盖了MySQL 5.7系列软件版本。
Because this manual serves as a reference, it does not provide general instruction on SQL or relational database concepts. 因为本手册只是作为参考,所以不提供有关SQL或关系数据库概念的一般说明。It also does not teach you how to use your operating system or command-line interpreter.它也不会教你如何使用操作系统或命令行解释器。
The MySQL Database Software is under constant development, and the Reference Manual is updated frequently as well. MySQL数据库软件不断开发,参考手册也不断更新。The most recent version of the manual is available online in searchable form at https://dev.mysql.com/doc/. 该手册的最新版本可在线搜索,网址为https://dev.mysql.com/doc/。Other formats also are available there, including downloadable HTML and PDF versions.其他格式也有,包括可下载的HTML和PDF版本。
The source code for MySQL itself contains internal documentation written using Doxygen. MySQL的源代码本身包含使用Doxygen编写的内部文档。The generated Doxygen content is available https://dev.mysql.com/doc/index-other.html. 生成的Doxygen内容可在https://dev.mysql.com/doc/index-other.html上查看到。It is also possible to generate this content locally from a MySQL source distribution using the instructions at Section 2.9.10, “Generating MySQL Doxygen Documentation Content”.也可以使用第2.9.10节,“生成MySQL Doxygen文档内容”中的说明从MySQL源发行版本地生成此内容。
If you have questions about using MySQL, join the MySQL Community Slack, or ask in our forums; see MySQL Community Support at the MySQL Forums. 如果你对使用MySQL有疑问,可以加入MySQL社区Slack,或者在我们的论坛上提问;请参阅MySQL论坛上的MySQL社区支持。If you have suggestions concerning additions or corrections to the manual itself, please send them to the http://www.mysql.com/company/contact/.如果您对手册本身的添加或更正有任何建议,请发送至http://www.mysql.com/company/contact/。
This manual uses certain typographical conventions:本手册使用某些排版惯例:
Text in this style
is used for SQL statements; database, table, and column names; program listings and source code; and environment variables. Example: “To reload the grant tables, use the FLUSH PRIVILEGES
statement.”
Text in this style
indicates input that you type in examples.
Text in this style indicates the names of executable programs and scripts, examples being mysql (the MySQL command-line client program) and mysqld (the MySQL server executable).
Text in this style
is used for variable input for which you should substitute a value of your own choosing.
Text in this style is used for emphasis.
Text in this style is used in table headings and to convey especially strong emphasis.
Text in this style
is used to indicate a program option that affects how the program is executed, or that supplies information that is needed for the program to function in a certain way. Example: “The --host
option (short form -h
) tells the mysql client program the hostname or IP address of the MySQL server that it should connect to”.
File names and directory names are written like this: “The global my.cnf
file is located in the /etc
directory.”
Character sequences are written like this: “To specify a wildcard, use the ‘%
’ character.”
When commands are shown that are meant to be executed from within a particular program, the prompt shown preceding the command indicates which command to use. 当显示要在特定程序中执行的命令时,命令前面显示的提示符指示要使用哪个命令。For example, shell>
indicates a command that you execute from your login shell, root-shell>
is similar but should be executed as root
, and mysql>
indicates a statement that you execute from the mysql client program:
shell>type a shell command here
root-shell>type a shell command as
mysql>root
heretype a mysql statement here
In some areas different systems may be distinguished from each other to show that commands should be executed in two different environments. 在某些领域,不同的系统可能会相互区别,以表明命令应该在两个不同的环境中执行。For example, while working with replication the commands might be prefixed with 例如,在使用复制时,命令的前缀可能是source
and replica
:source
和replica
:
source>type a mysql command on the replication source here
replica>type a mysql command on the replica here
The “shell” is your command interpreter. On Unix, this is typically a program such as sh, csh, or bash. On Windows, the equivalent program is command.com or cmd.exe, typically run in a console window.
When you enter a command or statement shown in an example, do not type the prompt shown in the example.输入示例中所示的命令或语句时,不要键入示例中所示的提示。
Database, table, and column names must often be substituted into statements. 数据库、表和列名通常必须替换为语句。To indicate that such substitution is necessary, this manual uses db_name
, tbl_name
, and col_name
. For example, you might see a statement like this:
mysql> SELECT col_name
FROM db_name
.tbl_name
;
This means that if you were to enter a similar statement, you would supply your own database, table, and column names, perhaps like this:这意味着,如果要输入类似的语句,则需要提供自己的数据库、表和列名,可能如下所示:
mysql> SELECT author_name FROM biblio_db.author_list;
SQL keywords are not case-sensitive and may be written in any lettercase. This manual uses uppercase.
In syntax descriptions, square brackets (“[
” and “]
”) indicate optional words or clauses. For example, in the following statement, IF EXISTS
is optional:
DROP TABLE [IF EXISTS] tbl_name
When a syntax element consists of a number of alternatives, the alternatives are separated by vertical bars (“|
”). When one member from a set of choices may be chosen, the alternatives are listed within square brackets (“[
” and “]
”):
TRIM([[BOTH | LEADING | TRAILING] [remstr
] FROM]str
)
When one member from a set of choices must be chosen, the alternatives are listed within braces (“{
” and “}
”):
{DESCRIBE | DESC}tbl_name
[col_name
|wild
]
An ellipsis (...
) indicates the omission of a section of a statement, typically to provide a shorter version of more complex syntax. For example, SELECT ... INTO OUTFILE
is shorthand for the form of SELECT
statement that has an INTO OUTFILE
clause following other parts of the statement.
An ellipsis can also indicate that the preceding syntax element of a statement may be repeated. In the following example, multiple reset_option
values may be given, with each of those after the first preceded by commas:
RESETreset_option
[,reset_option
] ...
Commands for setting shell variables are shown using Bourne shell syntax. For example, the sequence to set the CC
environment variable and run the configure command looks like this in Bourne shell syntax:
shell> CC=gcc ./configure
If you are using csh or tcsh, you must issue commands somewhat differently:
shell>setenv CC gcc
shell>./configure
The Reference Manual source files are written in DocBook XML format. 参考手册源文件是以DocBook XML格式编写的。The HTML version and other formats are produced automatically, primarily using the DocBook XSL stylesheets. HTML版本和其他格式是自动生成的,主要使用DocBook XSL样式表。For information about DocBook, see 有关DocBook的信息,请参阅http://docbook.org/
This manual was originally written by David Axmark and Michael “Monty” Widenius. 本手册最初由David Axmark和Michael“Monty”Widenius编写。It is maintained by the MySQL Documentation Team, consisting of Chris Cole, Paul DuBois, Margaret Fisher, Edward Gilmore, Stefan Hinz, David Moss, Philip Olson, Daniel Price, Daniel So, and Jon Stephens.它由MySQL文档团队维护,该团队由Chris Cole、Paul DuBois、Margaret Fisher、Edward Gilmore、Stefan Hinz、David Moss、Philip Olson、Daniel Price、Daniel So和Jon Stephens组成。