A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.databend.com/sql/sql-commands/ddl/user/user-create-user below:

CREATE USER | Databend

Introduced or updated: v1.2.703

Creates a SQL user for connecting to Databend. Users must be granted appropriate privileges to access databases and perform operations.

See also:

Syntax
CREATE [ OR REPLACE ] USER <name> IDENTIFIED [ WITH <auth_type> ] BY '<password>' 
[ WITH MUST_CHANGE_PASSWORD = true | false ]
[ WITH SET PASSWORD POLICY = '<policy_name>' ]
[ WITH SET NETWORK POLICY = '<policy_name>' ]
[ WITH DEFAULT_ROLE = '<role_name>' ]
[ WITH DISABLED = true | false ]

Parameters:

Examples Example 1: Create User and Grant Database Privileges

Create a user and grant database privileges:


CREATE USER data_analyst IDENTIFIED BY 'secure_password123';


GRANT SELECT, INSERT ON default.* TO data_analyst;

Verify the user and permissions:

SHOW GRANTS FOR data_analyst;
+
| Grants |
+
| GRANT SELECT,INSERT ON 'default'.* TO 'data_analyst'@'%' |
+
Example 2: Create User and Grant Role

Create a user and assign a role with specific privileges:


CREATE ROLE analyst_role;
GRANT SELECT ON *.* TO ROLE analyst_role;
GRANT INSERT ON default.* TO ROLE analyst_role;


CREATE USER john_analyst IDENTIFIED BY 'secure_pass456';
GRANT ROLE analyst_role TO john_analyst;

Verify the role assignment:

SHOW GRANTS FOR john_analyst;
+
| Grants |
+
| GRANT SELECT ON *.* TO 'analyst_role' |
| GRANT INSERT ON 'default'.* TO 'analyst_role' |
+
Example 3: Create Users with Different Authentication Types

CREATE USER user1 IDENTIFIED BY 'abc123';


CREATE USER user2 IDENTIFIED WITH sha256_password BY 'abc123';
Example 4: Create Users with Special Configurations

CREATE USER new_employee IDENTIFIED BY 'temp123' WITH MUST_CHANGE_PASSWORD = true;


CREATE USER temp_user IDENTIFIED BY 'abc123' WITH DISABLED = true;


CREATE USER manager IDENTIFIED BY 'abc123' WITH DEFAULT_ROLE = 'admin';
GRANT ROLE admin TO manager;

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4