OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.2.5

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.2.5
    iconOceanBase Database
    SQL - V 4.2.5
    SQL
    KV
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Login failure handling

    Last Updated:2026-04-09 09:38:52  Updated
    share
    What is on this page
    Login failure handling strategy
    Examples

    folded

    share

    In MySQL mode of OceanBase Database, for users who have multiple failed login attempts, the system will lock the users to prevent malicious password attacks, thereby improving database security.

    Login failure handling strategy

    In MySQL mode of OceanBase Database, you can set the connection_control_failed_connections_threshold parameter for a tenant to specify the threshold for control over failed login attempts. If the number of consecutive failed login attempts exceeds the value of this parameter, the system locks the account.

    The default value of the connection_control_failed_connections_threshold parameter is 0, and the value range is [0, 2147483647]. Take note of the following items when you specify a parameter value:

    • The value 0 indicates that the feature is disabled. In this case, no action is taken against failed login attempts.

    • If you set the parameter to a value other than 0, the account of a user is locked when the number of failed login attempts by the user exceeds the specified value. The lock duration is calculated by using the following formula:

      MIN(MAX((current_failed_login_num + 1 - connection_control_failed_connections_threshold) * 1000, connection_control_min_connection_delay), connection_control_max_connection_delay).

      In this formula:

      • current_failed_login_num indicates the number of consecutive failed login attempts by a user. The value of the current_failed_login_num parameter is greater than or equal to that of the connection_control_failed_connections_threshold parameter.

      • connection_control_min_connection_delay indicates the minimum lock duration in milliseconds after the number of consecutive failed login attempts exceeds the specified threshold. The value range is [1000, 2147483647]. The default value is 1000.

      • connection_control_max_connection_delay indicates the maximum lock duration in milliseconds after the number of consecutive failed login attempts exceeds the specified threshold. The value range is [1000, 2147483647]. The default value is 2147483647.

    Examples

    1. Log in to a MySQL tenant of a cluster as the root user.

      obclient -uroot@mysql -h127.1 -P2881 -p********
      
    2. Set the threshold of failed login attempts to 5, and set the minimum lock duration and maximum lock duration after the number of consecutive failed login attempts reaches the specified threshold to 60,000 ms and 360,000 ms respectively.

      Here is an example:

      obclient> ALTER SYSTEM SET connection_control_failed_connections_threshold=5;
      
      obclient> ALTER SYSTEM SET connection_control_min_connection_delay=60000;
      
      obclient> ALTER SYSTEM SET connection_control_max_connection_delay=360000;
      

      For more information about the parameters, see Modify cluster parameters.

    3. Create a user.

      obclient> CREATE USER 'test' IDENTIFIED BY '*******';
      Query OK, 0 rows affected (0.04 sec)
      
    4. Verify the login failure handling strategy. If you enter an incorrect password five consecutive times, your account will be locked.

      obclient -h127.1 -P2881 -utest@mysql -p*******;
      obclient: [Warning] Using a password on the command line interface can be insecure.
      ERROR 5039 (01007): User locked
      

      Log in to the MySQL tenant as the root user to view the login failure information.

      obclient> SELECT * FROM information_schema.CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS;
      +-------------+-----------------+
      | USERHOST    | FAILED_ATTEMPTS |
      +-------------+-----------------+
      | 'test'@'%' |               5 |
      +-------------+-----------------+
      1 row in set (0.005 sec)
      
    5. Unlock the user.

      Notice

      If you log in as the administrator, you can directly lock and unlock users. If you log in as a regular user, you must have the global ALTER USER privilege to lock and unlock users. For more information about how to view and grant user privileges, see View user privileges and Grant direct privileges.

         obclient> ALTER USER test ACCOUNT UNLOCK;
         Query OK, 0 rows affected (0.03 sec)
      

    Previous topic

    Password complexity
    Last

    Next topic

    Identity authentication
    Next
    What is on this page
    Login failure handling strategy
    Examples