Advanced
Тема интерфейса

Using User Management Commands

This section describes how to use basic syntax and SQL statements to manage users.

  1. Creating a user
    • Use CREATE USER command to create a Doris user (without a role).
      CREATE USER 'Jack' IDENTIFIED BY 'password';
      Table 1 Parameters

      Parameter

      Description

      Jack

      Username

      password

      Password of the created user

      Note

      You can run the command to specify an IP address.

      CREATE USER 'jack02' @'192.168.%' identified by '123456' DEFAULT ROLE 'default_role';
    • Use CREATE USER command to create a Doris user (without the default role assigned).
      CREATE USER 'jeo' IDENTIFIED BY 'password' DEFAULT ROLE 'default_role';
  2. Changing a user password

    Use the ALTER USER command to change the password of a user.

    ALTER USER 'Jack' IDENTIFIED BY "password";

  3. Assigning a role to the user
    • Assign a role to the user.
      GRANT 'role1','role2' TO 'jack'@'%';
      Table 2 Parameters

      Parameter

      Description

      role

      Created role

      jack

      Name of the new user

    • Revoke the role assigned to the user.
      REVOKE 'role1' FROM 'candy';
  4. Delete a user.
    DROP USER'Jack';