<@U0A71G31CDV> how to view default catalog and tab...
# questions-and-troubleshooting
k
@Rocky how to view default catalog and table on user, and how to set
r
To view and set the default catalog and database (there is no concept of a "default table" per user) for a StarRocks user, you can use the following commands: 1. How to View Use the
SHOW PROPERTY
command to see the default catalog and database assigned to a user. * View your own properties:
Copy code
sql
    SHOW PROPERTY;
* View properties for a specific user (requires
user_admin
role):
Copy code
sql
    SHOW PROPERTY FOR 'username';
Output example:
Copy code
text
    +----------------------+-----------------+
    | Key                  | Value           |
    +----------------------+-----------------+
    | catalog              | default_catalog |
    | database             | sales_db        |
    | max_user_connections | 100             |
    +----------------------+-----------------+
2. How to Set Use the
ALTER USER
command with the
SET PROPERTIES
clause. This feature is supported starting from StarRocks v3.3.3. * Set the default catalog:
Copy code
sql
    ALTER USER username SET PROPERTIES ("catalog" = "your_catalog_name");
* Set both default catalog and database:
Copy code
sql
    ALTER USER username SET PROPERTIES ("catalog" = "your_catalog_name", "database" = "your_db_name");
* Clear the default settings:
Copy code
sql
    ALTER USER username SET PROPERTIES ("catalog" = "", "database" = "");
Important Notes: * Username format: When using
ALTER USER ... SET PROPERTIES
, you must specify the
username
(e.g.,
'jack'
), not the full user identity (e.g.,
'jack'@'%'
). * Session Level: To change the catalog or database only for your current session (not permanently for the user), use:
Copy code
sql
    SET CATALOG <catalog_name>;
    USE <db_name>;
    -- OR
    USE <catalog_name>.<db_name>;
References • sql-reference/sql-statements/account-management/SHOW_PROPERTY.md • data_source/catalog/default_catalog.md • sql-reference/sql-statements/Catalog/SET_CATALOG.md • sql-reference/sql-statements/account-management/ALTER_USER.md • data_source/catalog/unified_catalog.md • sql-reference/sql-statements/account-management/SET_DEFAULT_ROLE.md
k
@Rocky how to remove user from rg
r
To remove a user from a resource group (RG) in StarRocks, you must delete the classifier that associates that user with the group. Follow these steps: 1. Identify the Classifier ID First, find the ID of the classifier that maps the user to the resource group.
Copy code
sql
-- View all resource groups and their classifiers
SHOW RESOURCE GROUPS ALL;

-- Or view a specific group
SHOW RESOURCE GROUP <group_name>;
In the output, look for the
classifiers
column. It will look like
(id=15016, weight=1.0, user=jack)
. Note the ID. 2. Remove the Classifier Use the
ALTER RESOURCE GROUP
command to drop the specific classifier ID you identified.
Copy code
sql
ALTER RESOURCE GROUP <group_name> DROP (<classifier_id>);
Example:
Copy code
sql
ALTER RESOURCE GROUP rg1 DROP (15016);
3. (Alternative) Remove all classifiers If you want to clear all mappings (users, roles, etc.) from a resource group at once:
Copy code
sql
ALTER RESOURCE GROUP <group_name> DROP ALL;
Important Notes * Default Group: If a user is removed from all resource groups and doesn't match any other classifiers, their queries will fall back to the
default_wg
(default resource group). * Session Override: If a user has manually set a resource group for their session using
SET resource_group = 'xxx';
, they can revert it by setting it to the default or another group:
Copy code
sql
    SET resource_group = 'default_wg';
* Privileges: You must have the
ALTER
privilege on the target resource group to perform these actions. References • administration/management/resource_management/resource_group.md • sql-reference/sql-statements/cluster-management/resource_group/ALTER_RESOURCE_GROUP.md • sql-reference/sql-statements/cluster-management/resource_group/SHOW_USAGE_RESOURCE_GROUPS.md References • sql-reference/sql-statements/cluster-management/resource_group/DROP_RESOURCE_GROUP.md • administration/user_privs/authorization/privilege_item.md • administration/management/resource_management/resource_group.md • sql-reference/sql-statements/cluster-management/resource_group/ALTER_RESOURCE_GROUP.md • sql-reference/sql-statements/Resource/DROP_RESOURCE.md