Help Center > > Developer Guide> Database Security Management> Setting Account Security Policies> Setting the Validity Period of an Account

Setting the Validity Period of an Account

Updated at: Mar 13, 2020 GMT+08:00

When creating a user, you need to specify the validity period of the user, including the start time and end time.

To enable a user not within the validity period to use its account, set a new validity period.

Procedure

  1. Run the following command to create a user and specify the start time and end time of its validity period:

    1
    CREATE USER joe WITH PASSWORD 'Bigdata@123' VALID BEGIN '2015-10-10 08:00:00' VALID UNTIL '2016-10-10 08:00:00';
    

    The user is created if the following information is displayed:

    CREATE ROLE

  2. If the user is not within the specified validity period, run the following command to set the start time and end time of a new validity period.

    1
    ALTER USER joe WITH VALID BEGIN '2016-11-10 08:00:00' VALID UNTIL '2017-11-10 08:00:00';
    

    The user is created if the following information is displayed:

    ALTER ROLE

If VALID BEGIN is not specified in the CREATE ROLE or ALTER ROLE statement, the start time of the validity period is not limited. If VALID UNTIL is not specified, the end time of the validity period is not limited. If both of the parameters are not specified, the user is always valid.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel