> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lwops.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 重置平台Admin账密

1. 使用root 账号登录乐维所在服务器。
2. 生成目标密码的 bcrypt 哈希串。（例如：将登录密码重置为 123456）

执行以下 Python 命令生成 **2y** 格式哈希（和系统原有加密规则兼容）：

```python theme={null}
python3 -c "
import bcrypt
salt = bcrypt.gensalt(10).replace(b'\$2b\$', b'\$2y\$')
hash_pwd = bcrypt.hashpw(b'123456', salt).decode()
print(hash_pwd)
"
```

示例输出（每次执行结果不同，以本机输出为准）：

\$2y\$10\$IyynJ7Kv52BrkxIM9Ia8VuCShCQxzsEql5LuJHEXwPnVrpGWbY0jW

![Renameadmin1](https://mintcdn.com/lerwee/y6TXXx3dyCwGd_ss/images/renameadmin1.png?fit=max\&auto=format\&n=y6TXXx3dyCwGd_ss\&q=85\&s=f704c396be5be6ad1bfeca310b0be649)

3. 登录 PostgreSQL 数据库

```text theme={null}
psql -d lwops
```

4. 更新 Admin 账号密码，复制上一步生成的 \$2y\$ 开头哈希串，执行 SQL 更新：

```python theme={null}
UPDATE lwops_auth_users
SET password = '此处粘贴你本机生成的$2y$哈希串' 
WHERE username = 'Admin';
```

执行成功返回：UPDATE 1

![Renameadmin2](https://mintcdn.com/lerwee/y6TXXx3dyCwGd_ss/images/renameadmin2.png?fit=max\&auto=format\&n=y6TXXx3dyCwGd_ss\&q=85\&s=3501952a9b7d5c924a0113100d5510ec)

5. 校验账号状态（必做）。确认账号存在、密码已更新、账号为启用状态：

```python theme={null}
SELECT username, password, status FROM lwops_auth_users WHERE username='Admin';
```

![Renameadmin3](https://mintcdn.com/lerwee/y6TXXx3dyCwGd_ss/images/renameadmin3.png?fit=max\&auto=format\&n=y6TXXx3dyCwGd_ss\&q=85\&s=d97825a9d0e8e2ef026303de1a29675c)

6. 退出数据库

```text theme={null}
\q
```

7. 重启PostgreSQL数据库服务

```python theme={null}
systemctl restart postgresqld
```

8. 打开浏览器访问乐维 Web 地址，使用以下账号登录

用户名：Admin

密码：123456


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.