Path: API › 数据库管理

`POST /database`

获取指定 MySQL 服务器上所有用户及其权限详情。

## Request body

_Required._

- `action65.request_time` (string, required) — Unix 时间戳。
- `action65.request_token` (string, required) — 按 API 概览生成的签名。
- `action65.action` (string, required) — 具体操作名称。
  - one of `"GetMysqlUser"`
- `action65.sid` (integer, required) — 服务器 ID，`0` = 本地

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "GetMysqlUser",
  "sid": 0
}
```

## 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=GetMysqlUser" \
  --data-urlencode "sid=<sid>"
```

## Responses

### default

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

#### Example

```json
{
  "status": true,
  "msg": "ok",
  "data": [
    {
      "user": "root",
      "list": [
        {
          "host": "localhost",
          "password": "有"
        }
      ]
    }
  ]
}
```

- `action65.response.default.user` (string, optional) — 用户名
- `action65.response.default.list` (array<unknown>, optional) — 该用户在各主机上的权限列表
- `action65.response.default.list[].host` (string, optional) — 主机（`localhost` / `%`）
- `action65.response.default.list[].password` (string, optional) — 是否有密码（`有` / `无`）
- `action65.response.default.list[].password_last_changed` (string, optional) — 密码最后修改时间
- `action65.response.default.list[].access_list` (array<unknown>, optional) — 数据库级权限列表


## GetMysqlUser

获取指定 MySQL 服务器上所有用户及其权限详情。

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

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `GetMysqlUser` |
| sid | 是 | Integer | 服务器 ID，`0` = 本地 |

## 输出参数

`data` 为数组，每项：

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| user | String | 用户名 |
| list | Array | 该用户在各主机上的权限列表 |
| list[].host | String | 主机（`localhost` / `%`） |
| list[].password | String | 是否有密码（`有` / `无`） |
| list[].password_last_changed | String | 密码最后修改时间 |
| list[].access_list | Array | 数据库级权限列表 |

## 示例

```
POST /database HTTP/1.1
Content-Type: application/x-www-form-urlencoded

action=GetMysqlUser&sid=0
```

```json
{"status": true, "msg": "ok", "data": [
    {"user": "root", "list": [{"host": "localhost", "password": "有"}]}
]}
```

