Path: API › 数据库管理

`POST /database`

管理 MySQL 二进制日志。

## Request body

_Required._

- `action47.request_time` (string, required) — Unix 时间戳。
- `action47.request_token` (string, required) — 按 API 概览生成的签名。
- `action47.action` (string, required) — 固定值 `BinLog`

## Example request

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

## 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=<action>"
```

## Responses

### default

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

#### Example

```json
{
  "status": true,
  "msg": "清理完成!"
}
```

- `action47.response.default.status` (boolean, optional) — 请求结果，`true` 表示成功
- `action47.response.default.msg` (string, optional) — 提示信息


## BinLog

## BinLog / GetMySQLBinlogs / ClearMySQLBinlog

管理 MySQL 二进制日志。

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

## BinLog

开启或关闭二进制日志。

### 输入参数

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

### 响应

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| status | Boolean | 请求结果，`true` 表示成功 |
| msg | String | 提示信息 |

```json
{"status": true, "msg": "开启二进制日志成功！", "data": {"binlog_status": true}}
```

## GetMySQLBinlogs

获取二进制日志文件列表及大小。

### 响应

```json
{"status": true, "msg": "ok", "data": [
    {"name": "mysql-bin.000001", "path": "/www/server/data/mysql-bin.000001", "size": 177}
]}
```

## ClearMySQLBinlog

清理指定天数前的二进制日志。

### 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `ClearMySQLBinlog` |
| days | 是 | Integer | 保留天数 |

### 响应

```json
{"status": true, "msg": "清理完成!"}
```

