# 简介

在本教程中，我们将向您介绍MySQL全文搜索及其功能。

MySQL支持使用[LIKE](http://www.yiibai.com/mysql/like.html)运算符和[正则表达式](http://www.yiibai.com/mysql/regular-expression-regexp.html)进行文本搜索。但是，当文本列较大并且表中的行数增加时，使用这些方法有一些限制：

* 性能问题：MySQL必须扫描整个表以根据正则表达式中的`LIKE`语句或模式中的模式查找确切的文本。
* 灵活搜索：使用`LIKE`运算符和正则表达式搜索，很难进行灵活的搜索查询，例如，查找描述包含`car`但不是`classic`的产品。
* 相关性排名：没有办法指定结果集中的哪一行与搜索字词更相关。

由于这些限制，MySQL扩展了一个非常好的功能，叫作*全文搜索*。从技术上讲，MySQL从启用的全文搜索列的单词中创建一个索引，并对该索引进行搜索。 MySQL使用复杂的算法来确定与搜索查询匹配的行。

以下是MySQL全文搜索的一些重要功能：

* 本地SQL类接口：使用类似SQL的语句来使用全文搜索。
* 完全动态的索引：当该列的数据发生变化时，MySQL会自动更新文本列的索引。
* 适度的索引大小：它不需要太多的内存来存储索引。
* 最后一个是，基于复杂的搜索查询快速搜索。

请注意，并非所有[存储引擎](http://www.yiibai.com/mysql/understand-mysql-table-types-innodb-myisam.html)都支持全文搜索功能。在MySQL 5.6或更高版本中，只有*MyISAM*和*InnoDB*存储引擎支持全文搜索。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hezhiqiang-book.gitbook.io/mysql/di-liu-zhang/jian-jie.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
