DataGrip 2022.2 Help

Users and roles

Different databases use concepts of users and roles to manage the permissions in your databases. Both of them are used for access control and define a set of permissions. Consult with the documentation of your database vendor what type of concept the database uses for access control. In some databases, a role can be a user that has the login right.

Create users and roles

  1. In the Database Explorer (View | Tool Windows | Database Explorer), right-click a data source node and navigate to New | User or New | Role.

    For some databases, you need to specify a database where you want to create a role or a user. In this case, you must expand the data source tree to the database node, right-click the database node and select New | User or New | Role.

  2. Select the necessary database settings. In the Preview pane, you can change the generated SQL code.

  3. Click OK.

    To see your changes, press Ctrl+F5.

    Create a user

Configure GRANT privileges for objects

  1. In the Database Explorer (View | Tool Windows | Database Explorer), right-click an object and select Modify <Object>.

  2. On the Grants tab, click the Add button (the Add button).

  3. In the user field, type the username. You can press Ctrl+Space to use code completion in this field.

  4. Click the grant field, from the drop-down near each privilege, select Grant or Grant with option. The Grant with option privilege means that a user can grant to or revoke from other users those privileges.

Grant permissions to objects

  1. In the Database Explorer (View | Tool Windows | Database Explorer), right-click a user or a role and select Modify Role.

  2. In the Grants section of the Modify dialog, add (the Add icon) or remove (the Remove icon) permissions to database objects.

    You can use auto-completion for database objects.

  3. Click the grant field, from the drop-down near each privilege, select Grant or Grant with option. The Grant with option privilege means that a user can grant to or revoke from other users those privileges.

    GRANT permissions for users
Last modified: 04 August 2022