How to create users and assign permissions in DB2?
Creating users and assigning permissions in DB2 can be done using the following steps:
- To begin with, login to the DB2 database with administrator privileges.
- Create a user:
Use the following command to create a new user: - Add a new user with the specified username.
- username is the name of the user to be created.
- Assign permissions:
Use the following command to assign permissions to users: - Give permission on the object to the username.
- In this case, permission refers to the specific access rights to be assigned (such as SELECT, INSERT, UPDATE, DELETE, etc.), object represents the entity being granted permission (such as a table, view, etc.), and username is the user to whom the permission is being assigned.
For example, to grant SELECT permission to the user test:
GRANT SELECT ON schema.table TO test
- Pledge
By following the above steps, you can create a user in the DB2 database and assign appropriate permissions to them.