# MySQL

## 关于

默认情况下，组和玩家是储存在不同的文件下。（groups.yml 和 users.yml）

启用 MySQL 将会使用它来储存组和玩家的数据而不是储存在本地的文件里。

playerdata.yml 文件 (用来储存玩家开关计分板、boss条并记录他们偏好的文件 ) 将不会受到影响，或许在后续版本我们会提供支持。

## 配置

在 **config.yml** 找到如下部分：

```
mysql:
  enabled: false
  host: 127.0.0.1
  port: 3306
  database: tab
  username: user
  password: password
```

`enabled` 将决定插件是否使用 **MySQL** 储存，其他选项则是修改 MySQL 数据库信息的。

## 数据转换

### 将数据从 MySQL 下载到本地文件

这可以通过使用指令 `/tab mysql download` 实现 (权限是 `tab.mysql.download`)。它将会从所连接的 MySQL 下载数据并保存到 users.yml 和 groups.yml 文件。\
这个指令只会在你使用 MySQL 储存数据时才会有效。

### 将数据上传到 MySQL

这可以通过使用指令 `/tab mysql upload` 实现 (权限是 `tab.mysql.upload`)。 它将会将本地 users.yml 和 groups.yml 文件的数据上传到所连接的 MySQL。\
这个指令只会在你使用 MySQL 储存数据时才会有效。


---

# 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://docs.superiormc.cn/tab-wiki/functions/mysql.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.
