Users and roles
Available only in PyCharm Professional: download to try or compare editions
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. In some databases, a role can be a user that has the login right.
note
Settings in the Create and Modify dialogs vary depending on the database vendor. Consult with the documentation of your database vendor for the settings list and what type of concept the database uses for access control.
Users and roles can be seen in the Database tool window. You can see a reference on node and object icons in the Data sources and their elements chapter of Database tool window topic.
Users and roles are not supported for the following database vendors: BigQuery, Couchbase Query, HSQLDB, MongoDB, Redis.
In the Database tool window ( View | Tool Windows | Database) , 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.
In the Create dialog that opens, enter the name of your user or role in the Name field.
Select and specify the necessary database settings.
In the Preview pane, you can view and change the generated SQL code.
Click OK.
![Create a user Create a user](https://resources.jetbrains.com/help/img/idea/2023.2/db_create_user_or_role.png)
You can grant a user and a role permissions for database objects.
tip
For other database objects, you can configure the permissions that each grantee has for the object, and the list of grantees. To do that, open the Modify dialog for the object and use the Grants pane.
In the Database tool window ( View | Tool Windows | Database) , right-click a user or a role and select Modify Role.
In the Grants pane of the Modify dialog, click the Add button (
).
You can use auto-completion for database objects.
Click the grant field, from the drop-down near each permission, select Grant or Grant with option. The Grant with option permission means that a user can grant to or revoke from other users those permissions.
Thanks for your feedback!