How to add a user to a database and add privileges? (Video)

 

Adding a user to a database and assigning appropriate privileges is crucial for managing database access securely.

Follow these steps to associate a user with a database and control their permissions in cPanel:


Step 1: Log in to cPanel

  1. Open your web browser and navigate to your cPanel login page (e.g., https://yourdomain.com:2083).
  2. Enter your username and password, then click Log in.

Step 2: Access the MySQL Databases Tool

  1. Scroll down to the Databases section in the cPanel dashboard.
  2. Click on MySQL Databases.

Step 3: Add a User to a Database

  1. Scroll to the Add User to Database section.
  2. Select the database user from the User dropdown menu.
  3. Select the database you want to associate with the user from the Database dropdown menu.
  4. Click Add to link the user to the database.

Step 4: Assign Privileges to the User

  1. After adding the user to the database, you’ll be redirected to the Manage User Privileges page.
  2. Select the privileges you want to grant to the user:
    • All Privileges: Grants full control of the database, including creating, modifying, and deleting tables and data. Recommended for applications requiring full access.
    • Specific Privileges: Choose only the permissions required for the user’s role (e.g.):
      • SELECT: Allows the user to read data.
      • INSERT: Allows the user to add new data.
      • UPDATE: Allows the user to modify existing data.
      • DELETE: Allows the user to remove data.
  3. Once you’ve selected the privileges, click Make Changes to save.

Step 5: Verify the User and Privileges

  1. Return to the MySQL Databases page.
  2. Scroll down to the Current Databases section.
  3. Verify that the user is listed alongside the database with the correct privileges.

Tips for Managing Database Users and Privileges

  • Grant Only Necessary Permissions: For security, assign the minimum privileges needed for the user’s tasks.
  • Use Descriptive Usernames: Create usernames that clearly indicate their purpose to keep things organized.
  • Backup Credentials: Securely store the database name, username, and password for future use.

By adding a user to a database and assigning privileges in cPanel, you ensure controlled and secure access for applications or team members interacting with the database.

  • 0 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Vezani članci

How to create a database in cPanel? (Video)

  Creating a database in cPanel is an essential step for hosting dynamic websites or...

How to rename a database in cPanel? (Video)

  cPanel does not provide a direct option to rename a database through its interface....

How to delete a database in cPanel? (Video)

  Deleting a database in cPanel is a straightforward process. Follow these steps to...

How to Create a Database Username in cPanel? (Video)

  Creating a database username in cPanel is essential for managing access to your databases....

How to import database via phpMyAdmin in cPanel? (Video)

  Importing a database using phpMyAdmin in cPanel is a straightforward process that allows you...