Path: API › 数据库管理

`POST /database`

获取 MySQL 运行时的内存相关配置参数，通过解析 `/etc/my.cnf` 和 `SHOW VARIABLES` 获得。

## Request body

_Required._

- `action57.request_time` (string, required) — Unix 时间戳。
- `action57.request_token` (string, required) — 按 API 概览生成的签名。
- `action57.action` (string, required) — 具体操作名称。
  - one of `"GetDbStatus"`

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "GetDbStatus"
}
```

## Code samples

### cURL（填写面板地址与签名）

```curl
curl --request POST \
  --url "https://your-panel.example.com:8888/database" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "request_time=<Unix时间戳>" \
  --data-urlencode "request_token=<按 API 概览生成的签名>" \
  --data-urlencode "action=GetDbStatus"
```

## Responses

### default

接口响应，业务状态见下方详细说明。

#### Example

```json
{
  "mem": {
    "query_cache_size": "0",
    "bt_query_cache_size": "0",
    "table_open_cache": 256,
    "thread_cache_size": 32,
    "query_cache_type": "OFF",
    "key_buffer_size": 64,
    "tmp_table_size": 64,
    "max_heap_table_size": "16777216",
    "innodb_buffer_pool_size": 256,
    "innodb_log_buffer_size": 32,
    "max_connections": 500,
    "sort_buffer_size": 1024,
    "read_buffer_size": 1024,
    "read_rnd_buffer_size": 256,
    "join_buffer_size": 256,
    "thread_stack": 256,
    "binlog_cache_size": 32,
    "query_cache_supprot": "disable"
  }
}
```

- `action57.response.default.query_cache_size` (string, optional) — 查询缓存大小
- `action57.response.default.bt_query_cache_size` (string, optional) — 面板设置的查询缓存
- `action57.response.default.query_cache_type` (string, optional) — 查询缓存类型：`ON` / `OFF` / `DEMAND`
- `action57.response.default.query_cache_supprot` (string, optional) — 查询缓存支持状态
- `action57.response.default.table_open_cache` (integer, optional) — 打开表缓存数量
- `action57.response.default.thread_cache_size` (integer, optional) — 线程缓存大小
- `action57.response.default.key_buffer_size` (integer, optional) — MyISAM 索引缓冲（MB）
- `action57.response.default.tmp_table_size` (integer, optional) — 临时表大小（MB）
- `action57.response.default.max_heap_table_size` (string, optional) — MEMORY 表最大大小
- `action57.response.default.innodb_buffer_pool_size` (integer, optional) — InnoDB 缓冲池大小（MB）
- `action57.response.default.innodb_log_buffer_size` (integer, optional) — InnoDB 日志缓冲（MB）
- `action57.response.default.max_connections` (integer, optional) — 最大连接数
- `action57.response.default.sort_buffer_size` (integer, optional) — 排序缓冲（KB）
- `action57.response.default.read_buffer_size` (integer, optional) — 读缓冲（KB）
- `action57.response.default.read_rnd_buffer_size` (integer, optional) — 随机读缓冲（KB）
- `action57.response.default.join_buffer_size` (integer, optional) — JOIN 缓冲（KB）
- `action57.response.default.thread_stack` (integer, optional) — 线程栈大小（KB）
- `action57.response.default.binlog_cache_size` (integer, optional) — Binlog 缓存（KB）


## GetDbStatus

获取 MySQL 运行时的内存相关配置参数，通过解析 `/etc/my.cnf` 和 `SHOW VARIABLES` 获得。

- **路由**：`POST /database`
- **action**：`GetDbStatus`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `GetDbStatus` |

## 输出参数

返回 `mem` 对象，包含以下 MySQL 配置项：

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| query_cache_size | String | 查询缓存大小 |
| bt_query_cache_size | String | 面板设置的查询缓存 |
| query_cache_type | String | 查询缓存类型：`ON` / `OFF` / `DEMAND` |
| query_cache_supprot | String | 查询缓存支持状态 |
| table_open_cache | Integer | 打开表缓存数量 |
| thread_cache_size | Integer | 线程缓存大小 |
| key_buffer_size | Integer | MyISAM 索引缓冲（MB） |
| tmp_table_size | Integer | 临时表大小（MB） |
| max_heap_table_size | String | MEMORY 表最大大小 |
| innodb_buffer_pool_size | Integer | InnoDB 缓冲池大小（MB） |
| innodb_log_buffer_size | Integer | InnoDB 日志缓冲（MB） |
| max_connections | Integer | 最大连接数 |
| sort_buffer_size | Integer | 排序缓冲（KB） |
| read_buffer_size | Integer | 读缓冲（KB） |
| read_rnd_buffer_size | Integer | 随机读缓冲（KB） |
| join_buffer_size | Integer | JOIN 缓冲（KB） |
| thread_stack | Integer | 线程栈大小（KB） |
| binlog_cache_size | Integer | Binlog 缓存（KB） |

## 示例

```json
{
    "mem": {
        "query_cache_size": "0",
        "bt_query_cache_size": "0",
        "table_open_cache": 256,
        "thread_cache_size": 32,
        "query_cache_type": "OFF",
        "key_buffer_size": 64,
        "tmp_table_size": 64,
        "max_heap_table_size": "16777216",
        "innodb_buffer_pool_size": 256,
        "innodb_log_buffer_size": 32,
        "max_connections": 500,
        "sort_buffer_size": 1024,
        "read_buffer_size": 1024,
        "read_rnd_buffer_size": 256,
        "join_buffer_size": 256,
        "thread_stack": 256,
        "binlog_cache_size": 32,
        "query_cache_supprot": "disable"
    }
}
```

