MySql 中文参考指南
Chapter 22 Using MySQL as a Document Store
目录
Table of Contents
本章介绍以文档存储方式处理 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 作为一个文档存储器,这是一个无架构,因此架构灵活性强,用于存储文档的存储系统。例如,当您创建描述产品的文档时,您不必在存储和操作文档之前知道和定义任何产品的 all 可能的属性。这不同于使用关系数据库,并在一个表中存储产品,当必须在向数据库中添加任何产品前了解和定义表的 all 列。本章中描述的功能使您可以选择如何配置 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 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 9.0. For instructions to verify X Plugin installation and to configure and monitor X Plugin, see Section 22.5, “X Plugin”.
-
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 9.0 Connectors.
-
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.