8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 22 使用 MySQL 作为文档存储
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 93%

第 22 章 使用 MySQL 作为文档存储Chapter 22 Using MySQL as a Document Store

本章介绍了一种将 MySQL 作为文档存储的替代工作方式,有时被称为“使用 NoSQL”。如果你的目的是以传统(SQL)方式使用 MySQL,本章内容可能与你无关。This chapter introduces an alternative way of working with MySQL as a document store, sometimes referred to as “using NoSQL”. If your intention is to use MySQL in a traditional (SQL) way, this chapter is probably not relevant to you.

传统上,关系型数据库如 MySQL 通常要求在存储文档之前定义模式。本节描述的功能使您能够将 MySQL 用作文档存储,这是一个无模式的,因此是模式灵活的文档存储系统。例如,当您创建描述产品的文档时,无需在存储和操作文档之前知道并定义任何产品的所有可能属性。这不同于使用关系型数据库并将产品存储在表中,在这种情况下,必须在向数据库添加任何产品之前知道并定义表的所有列。本章描述的功能使您可以选择如何配置 MySQL,仅使用文档存储模型,或将文档存储模型的灵活性与关系模型的强大功能结合使用。Traditionally, relational databases such as MySQL have usually required a schema to be defined before documents can be stored. The features described in this section enable you to use MySQL as a document store, which is a schema-less, and therefore schema-flexible, storage system for documents. For example, when you create documents describing products, you do not need to know and define all possible attributes of any products before storing and operating with the documents. This differs from working with a relational database and storing products in a table, when all columns of the table must be known and defined before adding any products to the database. The features described in this chapter enable you to choose how you configure MySQL, using only the document store model, or combining the flexibility of the document store model with the power of the relational model.

要将 MySQL 用作文档存储,您可以使用以下服务器功能:To use MySQL as a document store, you use the following server features:

  • X 插件使 MySQL 服务器能够使用 X 协议与客户端通信,这是将 MySQL 用作文档存储的先决条件。从 MySQL 8.4 起,MySQL 服务器默认启用 X 插件。有关验证 X 插件安装以及配置和监控 X 插件的说明,请参见 第 22.5 节,“X 插件”。X Plugin enables MySQL Server to communicate with clients using X Protocol, which is a prerequisite for using MySQL as a document store. X Plugin is enabled by default in MySQL Server as of MySQL 8.4. For instructions to verify X Plugin installation and to configure and monitor X Plugin, see Section 22.5, “X Plugin”.

  • X 协议支持 CRUD 和 SQL 操作,通过 SASL 进行认证,允许命令的流式传输(流水线),并且在协议和消息层上可扩展。与 X 协议兼容的客户端包括 MySQL Shell 和 MySQL 8.4 连接器。X Protocol supports both CRUD and SQL operations, authentication via SASL, allows streaming (pipelining) of commands and is extensible on the protocol and the message layer. Clients compatible with X Protocol include MySQL Shell and MySQL 8.4 Connectors.

  • 使用 X 协议与 MySQL 服务器通信的客户端可以使用 X DevAPI 来开发应用程序。X DevAPI 提供了一个现代化的编程接口,设计简单而强大,并支持行业标准的成熟概念。本章说明如何在 MySQL Shell 中使用 X DevAPI 的 JavaScript 或 Python 实现开始使用。有关使用 X DevAPI 的深入教程,请参见 X DevAPI 用户指南。Clients that communicate with a MySQL Server using X Protocol can use X DevAPI to develop applications. X DevAPI offers a modern programming interface with a simple yet powerful design which provides support for established industry standard concepts. This chapter explains how to get started using either the JavaScript or Python implementation of X DevAPI in MySQL Shell as a client. See X DevAPI User Guide for in-depth tutorials on using X DevAPI.