How Do I Set the Validity Period of an Account?
Answer: During the use of the database, some users are created to perform related operations on the database. When creating a user, you need to restrict the operation period (that is, the start time and end time of the validity period) of the user. The setting method is as follows:
- Use gsql to connect to the database.
- Run the following command to create a user and specify the start time and end time:
gaussdb=# CREATE USER jack WITH PASSWORD '********' VALID BEGIN '2015-10-10 08:00:00' VALID UNTIL '2016-10-10 08:00:00'; CREATE ROLE
The user is created if the CREATE ROLE information is displayed:
- If the user is not within the specified validity period, run the following command to set a new validity period, including the start time and end time.
gaussdb=# ALTER USER jack WITH VALID BEGIN '2016-11-10 08:00:00' VALID UNTIL '2017-11-10 08:00:00'; ALTER ROLE
The start time and end time of the new validity period is set successfully if the ALTER ROLE information is displayed:
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.