MySQL 5.1参考手册
这是MySQL参考手册的翻译版本,关于MySQL参考手册,请访问dev.mysql.com。
原始参考手册为英文版,与英文版参考手册相比,本翻译版可能不是最新的。This translation was done by MySQL partner GreatLinux,
Beijing, People's Republic of China. GreatLinux Inc. 北京万里开源软件有限公司在全国范围提供MySQL产品相关的商务及
技术方面的咨询与支持服务。垂询请致电:8610-65694500,或发送邮件至:sales@greatlinux.com.Copyright © 2005, 2010, Oracle and/or its affiliates. All
rights reserved.This software and related documentation are provided under a license
agreement containing restrictions on use and disclosure and are
protected by intellectual property laws. Except as expressly
permitted in your license agreement or allowed by law, you may not
use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any
part, in any form, or by any means. Reverse engineering,
disassembly, or decompilation of this software, unless required by
law for interoperability, is prohibited.The information contained herein is subject to change without notice
and is not warranted to be error-free. If you find any errors,
please report them to us in writing.如果将本软件或相关文档交付给美国政府,或者交付给以美国政府名义获得许可证的任
何机构,必须符合以下规定:U.S. GOVERNMENT RIGHTS Programs, software, databases, and related
documentation and technical data delivered to U.S. Government
customers are "commercial computer software" or "commercial
technical data" pursuant to the applicable Federal Acquisition
Regulation and agency-specific supplemental regulations. As such,
the use, duplication, disclosure, modification, and adaptation shall
be subject to the restrictions and license terms set forth in the
applicable Government contract, and, to the extent applicable by the
terms of the Government contract, the additional rights set forth in
FAR 52.227-19, Commercial Computer Software License (December 2007).
Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.This software is developed for general use in a variety of
information management applications. It is not developed or intended
for use in any inherently dangerous applications, including
applications which may create a risk of personal injury. If you use
this software in dangerous applications, then you shall be
responsible to take all appropriate fail-safe, backup, redundancy,
and other measures to ensure the safe use of this software. Oracle
Corporation and its affiliates disclaim any liability for any
damages caused by use of this software in dangerous applications.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. MySQL is a trademark of Oracle Corporation and/or its
affiliates, and shall not be used without Oracle's express written
authorization. Other names may be trademarks of their respective
owners.This software and documentation may provide access to or information
on content, products, and services from third parties. Oracle
Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party
content, products, and services. Oracle Corporation and its
affiliates will not be responsible for any loss, costs, or damages
incurred due to your access to or use of third-party content,
products, or services.This document in any form, software or printed matter, contains
proprietary information that is the exclusive property of Oracle.
Your access to and use of this material is subject to the terms and
conditions of your Oracle Software License and Service Agreement,
which has been executed and with which you agree to comply. This
document and information contained herein may not be disclosed,
copied, reproduced, or distributed to anyone outside Oracle without
prior written consent of Oracle or as specifically provided below.
This document is not part of your license agreement nor can it be
incorporated into any contractual agreement with Oracle or its
subsidiaries or affiliates.This documentation is NOT distributed under a GPL license. Use of
this documentation is subject to the following terms:You may create a printed copy of this documentation solely for your
own personal use. Conversion to other formats is allowed as long as
the actual content is not altered or edited in any way. You shall
not publish or distribute this documentation in any form or on any
media, except if you distribute the documentation in a manner
similar to how Oracle disseminates it (that is, electronically for
download on a Web site with the software) or on a CD-ROM or similar
medium, provided however that the documentation is disseminated
together with the software on the same medium. Any other use, such
as any dissemination of printed copies or use of this documentation,
in whole or in part, in another publication, requires the prior
written consent from an authorized representative of Oracle. Oracle
and/or its affiliates reserve any and all rights to this
documentation not expressly granted above.For more information on the terms of this license, for details on
how the MySQL documentation is built and produced, or if you are
interested in doing a translation, please visit
MySQL Contact &
Questions.For additional licensing information, including licenses for
libraries used by MySQL products, see Preface, Notes, Licenses.If you want help with using MySQL, please visit either the
MySQL Forums or
MySQL Mailing Lists
where you can discuss your issues with other MySQL users.For additional documentation on MySQL products, including
translations of the documentation into other languages, and
downloadable versions in variety of formats, including HTML and PDF
formats, see the MySQL
Documentation Library.摘要
这是MySQL参考手册 它涉及MySQL 5.1至5.1.2-alpha版本。
文档生成于: 2005-11-15
目录
前言- 1.
一般信息
2. 安装MySQL
2.1. 一般安装问题
2.2. 使用二进制分发版的标准MySQL安装
2.3. 在Windows上安装MySQL
2.3.1. Windows系统要求
2.3.2. 选择安装软件包
2.3.3. 用自动安装器安装MySQL
2.3.4. 使用MySQL安装向导
2.3.5. 使用配置向导
2.3.6. 通过非安装Zip文件安装MySQL
2.3.7. 提取安装档案文件
2.3.8. 创建选项文件
2.3.9. 选择MySQL服务器类型
2.3.10. 首次启动服务器
2.3.11. 从Windows命令行启动MySQL
2.3.12. 以Windows服务方式启动MySQL
2.3.13. 测试MySQL安装
2.3.14. 在Windows环境下对MySQL安装的故障诊断与排除
2.3.15. 在Windows下升级MySQL- 2.3.16.
Windows版MySQL同Unix版MySQL对比
2.4. 在Linux下安装MySQL
2.5.在Mac OS X中安装MySQL
2.6. 在NetWare中安装MySQL
2.7. 在其它类Unix系统中安装MySQL- 2.8.
使用源码分发版安装MySQL
2.9. 安装后的设置和测试
2.10. 升级MySQL
2.11. 降级MySQL
2.12. 具体操作系统相关的注意事项
2.13. Perl安装注意事项
3. 教程
4. MySQL程序概述
5. 数据库管理
6. MySQL中的复制
7. 优化
- 7.1.
优化概述
7.2. 优化SELECT语句和其它查询
- 7.2.1.
EXPLAIN语法(获取SELECT相关信息)
7.2.2. 估计查询性能
7.2.3. SELECT查询的速度
7.2.4. MySQL怎样优化WHERE子句
7.2.5. 范围优化
7.2.6. 索引合并优化
7.2.7. MySQL如何优化IS NULL
7.2.8. MySQL如何优化DISTINCT
7.2.9. MySQL如何优化LEFT JOIN和RIGHT JOIN
7.2.10. MySQL如何优化嵌套Join
7.2.11. MySQL如何简化外部联合
7.2.12. MySQL如何优化ORDER BY
7.2.13. MySQL如何优化GROUP BY
7.2.14. MySQL如何优化LIMIT
7.2.15. 如何避免表扫描
7.2.16. INSERT语句的速度
7.2.17. UPDATE语句的速度
7.2.18. DELETE语句的速度
7.2.19. 其它优化技巧
7.3. 锁定事宜
7.4. 优化数据库结构
7.5. 优化MySQL服务器
7.6. 磁盘事宜
8. 客户端和实用工具程序
8.1. 客户端脚本和实用工具概述- 8.2.
myisampack:生成压缩、只读MyISAM表- 8.3.
mysql:MySQL命令行工具- 8.4.
mysqlaccess:用于检查访问权限的客户端- 8.5.
mysqladmin:用于管理MySQL服务器的客户端- 8.6.
mysqlbinlog:用于处理二进制日志文件的实用工具- 8.7.
mysqlcheck:表维护和维修程序- 8.8.
mysqldump:数据库备份程序- 8.9.
mysqlhotcopy:数据库备份程序- 8.10.
mysqlimport:数据导入程序- 8.11.
mysqlshow-显示数据库、表和列信息- 8.12.
myisamlog:显示MyISAM日志文件内容- 8.13.
perror:解释错误代码
8.14. replace:字符串替换实用工具- 8.15.
mysql_zap:杀死符合某一模式的进程
9. 语言结构
10. 字符集支持
11. 列类型
12. 函数和操作符
13. SQL语句语法
14. 插件式存储引擎体系结构
15. 存储引擎和表类型
15.1. MyISAM存储引擎
15.2. InnoDB存储引擎
- 15.2.1.
InnoDB概述- 15.2.2.
InnoDB联系信息- 15.2.3.
InnoDB配置- 15.2.4.
InnoDB启动选项
15.2.5. 创建InnoDB表空间
15.2.6. 创建InnoDB表
15.2.7. 添加和删除InnoDB数据和日志文件
15.2.8. InnoDB数据库的备份和恢复
15.2.9. 将InnoDB数据库移到另一台机器上- 15.2.10.
InnoDB事务模型和锁定- 15.2.11.
InnoDB性能调节提示
15.2.12. 多版本的实施
15.2.13. 表和索引结构
15.2.14. 文件空间管理和磁盘I/O- 15.2.15.
InnoDB错误处理
15.2.16. 对InnoDB表的限制- 15.2.17.
InnoDB故障诊断与排除
15.3. MERGE存储引擎
15.4. MEMORY (HEAP)存储引擎
15.5. BDB (BerkeleyDB)存储引擎
15.6. EXAMPLE存储引擎
15.7. FEDERATED存储引擎
15.8. ARCHIVE存储引擎
15.9. CSV存储引擎
15.10. BLACKHOLE存储引擎
16. 编写自定义存储引擎- 17.
MySQL簇
18. 分区
19. MySQL中的空间扩展
20. 存储程序和函数
20.1. 存储程序和授权表
20.2. 存储程序的语法
- 20.2.1.
CREATE PROCEDURE和CREATE FUNCTION- 20.2.2.
ALTER PROCEDURE和ALTER FUNCTION- 20.2.3.
DROP PROCEDURE和DROP FUNCTION- 20.2.4.
SHOW CREATE PROCEDURE和SHOW CREATE
FUNCTION- 20.2.5.
SHOW PROCEDURE STATUS和SHOW FUNCTION
STATUS- 20.2.6.
CALL语句- 20.2.7.
BEGIN ... END复合语句- 20.2.8.
DECLARE语句
20.2.9. 存储程序中的变量
20.2.10. 条件和处理程序
20.2.11. 光标
20.2.12. 流程控制构造
20.3. 存储程序、函数、触发程序和复制:常见问题
20.4. 存储子程序和触发程序的二进制日志功能
21. 触发程序
22. 视图
23. INFORMATION_SCHEMA信息数据库
- 23.1.
INFORMATION_SCHEMA表
23.1.1. INFORMATION_SCHEMA SCHEMATA表
23.1.2. INFORMATION_SCHEMA TABLES表
23.1.3. INFORMATION_SCHEMA COLUMNS表- 23.1.4.
INFORMATION_SCHEMA STATISTICS表
23.1.5. INFORMATION_SCHEMA USER_PRIVILEGES表
23.1.6. INFORMATION_SCHEMA SCHEMA_PRIVILEGES表
23.1.7. INFORMATION_SCHEMA TABLE_PRIVILEGES表
23.1.8. INFORMATION_SCHEMA COLUMN_PRIVILEGES表
23.1.9. INFORMATION_SCHEMA CHARACTER_SETS表
23.1.10. INFORMATION_SCHEMA COLLATIONS表
23.1.11. INFORMATION_SCHEMA
COLLATION_CHARACTER_SET_APPLICABILITY表
23.1.12. INFORMATION_SCHEMA TABLE_CONSTRAINTS表
23.1.13. INFORMATION_SCHEMA KEY_COLUMN_USAGE表
23.1.14. INFORMATION_SCHEMA ROUTINES表
23.1.15. INFORMATION_SCHEMA VIEWS表
23.1.16. INFORMATION_SCHEMA TRIGGERS表
23.1.17. 其他INFORMATION_SCHEMA表
23.2. SHOW语句的扩展
24. 精度数学
25. API和库
- 25.1.
libmysqld,嵌入式MySQL服务器库- 25.2. MySQL C API
25.2.1. C API数据类型
25.2.2. C API函数概述
25.2.3. C API函数描述
25.2.4. C API预处理语句
25.2.5. C API预处理语句的数据类型
25.2.6. C API预处理语句函数概述
25.2.7. C API预处理语句函数描述
25.2.8. C API预处理语句方面的问题
25.2.9. 多查询执行的C API处理
25.2.10. 日期和时间值的C API处理
25.2.11. C API线程函数介绍
25.2.12. C API嵌入式服务器函数介绍
25.2.13. 使用C API时的常见问题
25.2.14. 创建客户端程序
25.2.15. 如何生成线程式客户端- 25.3. MySQL PHP API
- 25.4. MySQL Perl API
- 25.5. MySQL C++ API
- 25.6. MySQL Python API
- 25.7. MySQL Tcl API
- 25.8. MySQL Eiffel Wrapper
- 25.9.
MySQL程序开发实用工具
26. 连接器
- 26.1. MySQL Connector/ODBC
- 26.1.1.
MyODBC介绍
26.1.2. 关于ODBC和MyODBC的一般信息
26.1.3. 如何安装MyODBC
26.1.4. 在Windows平台上从二进制版本安装MyODBC
26.1.5. I在Unix平台上从二进制版本安装MyODBC
26.1.6. 在Windows平台上从源码版本安装MyODBC
26.1.7. 在Unix平台上从源码版本安装MyODBC
26.1.8. 从BitKeeper开发源码树安装MyODBC
26.1.9. MyODBC配置- 26.1.10.
与MyODBC连接相关的事宜- 26.1.11.
MyODBC和Microsoft Access- 26.1.12.
MyODBC和Microsoft VBA及ASP- 26.1.13.
MyODBC和第三方ODBC工具- 26.1.14.
MyODBC通用功能
26.1.15. 基本的MyODBC应用步骤
26.1.16. MyODBC API引用- 26.1.17.
MyODBC数据类型- 26.1.18.
MyODBC错误代码- 26.1.19.
MyODBC与VB:ADO、DAO和RDO- 26.1.20.
MyODBC与Microsoft.NET
26.1.21. 感谢- 26.2. MySQL Connector/NET
- 26.3. MySQL Connector/J
- 26.4. MySQL Connector/MXJ
27. 扩展MySQL
A. 问题和常见错误
B. 错误代码和消息
C. 感谢- D.
MySQL变更史
E. 移植到其他系统
F. 环境变量- G.
MySQL正则表达式
H. MySQL中的限制
I. 特性限制
J. GNU通用公共许可- K.
MySQL FLOSS许可例外
索引图形清单
- 14.1.
MySQL插件式存储引擎的体系结构- 14.2.
存储引擎比较- 16.1. MySQL体系结构
表格清单
- 26.1. 连接属性
- 26.2.
转换表- 26.3. 用于ResultSet.getObject()的MySQL类型和Java类型
- 26.4.
MySQL对Java编码名称的翻译
示例清单
- 26.1. 从DriverManager获得连接
- 26.2.
使用java.sql.Statement执行SELECT查询- 26.3.
存储程序示例- 26.4. 使用Connection.prepareCall()
- 26.5.
注册输出参数- 26.6. 设置CallableStatement输入参数
- 26.7.
检索结果和输出参数值- 26.8. 使用Statement.getGeneratedKeys()检索AUTO_INCREMENT列的值
- 26.9.
使用SELECT LAST_INSERT_ID()检索AUTO_INCREMENT列的值- 26.10.
在可更新的ResultSets中检索AUTO_INCREMENT列的值- 26.11.
设置Unix环境下的CLASSPATH- 26.12.
与J2EE应用服务器一起使用连接池- 26.13.
重试逻辑的事务示例这是MySQL参考手册的翻译版本,关于MySQL参考手册,请访问dev.mysql.com。
原始参考手册为英文版,与英文版参考手册相比,本翻译版可能不是最新的。