---
title: 用户被锁报错-V3.1.5-OceanBase 数据库文档-分布式数据库使用文档
description: 分布式数据库OceanBase 社区版文档中心，提供关于用户被锁报错的相关内容，方便用户更好的应用分布式数据库OceanBaseOceanBase 数据库
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
[OceanBase AI 数据大会](https://www.oceanbase.com/conference2026 "OceanBase AI 数据大会")文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*P8CuR4UJ_FkAAAAAAAAAAAAADiGDAQ/original) OceanBase 数据库分布式版 - V 3.1.5 社区版

# 用户被锁报错

更新时间：2026-06-11 14:45:35

[编辑](https://github.com/oceanbase/oceanbase-doc/edit/V3.1.5/zh-CN/1400.developer-guide/700.common-errors-and-solutions/400.user/100.user-locked-error.md)  

本文为您介绍用户被锁的相关报错及处理方式。

## 错误：ERROR 3118

### 错误码

- OceanBase 错误码：5039
 - 兼容 MySQL 错误码：3118

### 报错信息

```sql
ERROR 3118 (HY000):User locked

```

### 示例

登录 `ny1` 提示用户被锁。

```sql
[admin@**** /home/admin]
$obclient -h10.10.10.1 -P2881 -uny1@MySQL -p****** -A
obclient: [Warning] Using a password on the command line interface can be insecure.
ERROR 3118 (HY000): User locked

```

## 解决方法

1. 登录 `root` 用户。

   ```sql
   [admin@**** /home/admin]
   $obclient -h10.10.10.1 -P2881 -uroot@MySQL -p****** -A
   obclient: [Warning] Using a password on the command line interface can be insecure.
   Welcome to the OceanBase monitor.  Commands end with ; or \g.
   Your OceanBase connection id is 3221678880
   Server version: 5.7.25 OceanBase 3.1.4 (r20220110212853-f55615d0df8c3c2ca5dcd6b5dba8f0acd18c6264) (Built Jan 10 2022 22:09:16)

   Copyright (c) 2000, 2022, OceanBase and/or its affiliates. All rights reserved.

   Oracle is a registered trademark of Oracle Corporation and/or its
   affiliates. Other names may be trademarks of their respective
   owners.

   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

   obclient> Ctrl-C -- exit!
   Aborted

   ```
 2. 解锁用户 `ny1`。

   ```sql
   obclient> ALTER USER 'ny1' account UNLOCK;
   Query OK, 0 rows affected

   ```
 3. 再次登录 `ny1` 用户。

   ```sql
   [admin@**** /home/admin]
   $obclient -h10.10.10.1 -P2881 -uny1@MySQL -p****** -A
   obclient: [Warning] Using a password on the command line interface can be insecure.
   Welcome to the OceanBase monitor.  Commands end with ; or \g.
   Your OceanBase connection id is 3221678914
   Server version: 5.7.25 OceanBase 3.1.4 (r20220110212853-f55615d0df8c3c2ca5dcd6b5dba8f0acd18c6264) (Built Jan 10 2022 22:09:16)

   ```

 上一篇 下一篇 ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ) 咨询
