Source: https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/alter-user/ Documentation version: v5.3.2 # ALTER USER command The ALTER USER command is used to set the home schema and home graph for the current user in the catalog, or modify a user's password. The current active session remains valid after the home schema or home graph is set, or the password is changed. ## Prerequisites - Only the user with the role `ADMIN` can set the home schema or home graph for all users. Other users can only set their own home schema or home graph. - Each user can only change their own passwords. ## Syntax diagramsource alter_user_schema alter_user_graph alter_user_password_command ```` alter_user_schema ::= 'ALTER' 'USER' user_name 'SET' 'HOME_SCHEMA' schema_reference alter_user_graph ::= 'ALTER' 'USER' user_name 'SET' 'HOME_GRAPH' (schema_reference '/')? graph_name alter_user_password_command ::= 'ALTER' 'USER' user_name 'WITH' 'PASSWORD' '"' new_password '"' ```` ## Parameters ### `user_name` The name of the user whose home schema, home graph, or password is to be set or changed. ### `schema_reference` The reference to the path of the schema. - When setting the home schema for a user, it specifies the path of the schema to be set as the home schema. If not specified, the home schema for the user defaults to `/default_schema`. - When setting the home graph for a user, it specifies the schema path of the graph to be set as the home graph. To set a graph that resides outside the schema in the current session as the home graph, the schema path must be specified. If not specified, the home graph to be set for the user must be in the current schema. The path is case-sensitive and must match the path of an existing schema. Both absolute and relative schema paths can be used in the command. You can use [CREATE SCHEMA](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/schema/create/) to create a schema. For information about setting and viewing the schema for the current session, see [SESSION SET](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/sessions/set/) and [SHOW CURRENT_SCHEMA](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/show/show-current-schema/). Note Setting a home schema or home graph does not grant the user `USAGE` on the parent schema. If the home schema is not `/default_schema`, grant the required `USAGE` separately. For more information, see [Schema access control](https://dev-docs.nebula-graph.io/v5.3.2/server-admin/authorization/schema-access-control/). ### `graph_name` The name of the graph to be set as the home graph. The name is case-sensitive and must match the name of an existing graph. You can use [CREATE GRAPH](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/graph/create/) to create a graph. ### `new_password` The new password for the user. The new password must be enclosed in either double quotes or single quotes, be at least 8 characters in length, and include at least one digit, one lowercase letter, and one uppercase letter. ## Examples ### Set the home schema ```` ''' // Create a schema CREATE SCHEMA IF NOT EXISTS /my_schema ''' ''' // Set the home schema for the current user ALTER USER root SET HOME_SCHEMA /my_schema ''' ```` ### Set the graph in the current schema as the home graph ```` ''' // Create a graph type CREATE GRAPH TYPE IF NOT EXISTS home_graph_type AS {} ''' ''' // Create a graph CREATE GRAPH IF NOT EXISTS homegraph TYPED home_graph_type ''' ''' // Set the home graph for the current user ALTER USER root SET HOME_GRAPH homegraph ''' ```` ### Set the graph in the specified schema as the home graph ```` ''' // Create a graph type CREATE GRAPH TYPE IF NOT EXISTS home_graph_type AS {} ''' ''' // Create a graph CREATE GRAPH IF NOT EXISTS homegraph TYPED home_graph_type ''' ''' // Create a schema CREATE SCHEMA IF NOT EXISTS /my_schema ''' ''' // Set the schema for the current session SESSION SET SCHEMA /my_schema ''' ''' // Set the home graph for the current user ALTER USER root SET HOME_GRAPH /default_schema/homegraph ''' ```` ### Modify a user's password ```` ALTER USER root WITH PASSWORD "Password123" ```` ## More information - To view the information about the current user, use [SHOW CURRENT_USER](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/show/show-current-user/). - To view the information about all users who are invited to the current service group, use [SHOW USERS](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/show/show-users/). - To view the information about the current session, use [SHOW CURRENT_SESSION](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/show/show-current-session/). - To view the information about all sessions, use [SHOW SESSIONS](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/show/show-sessions/).