img-bg

How to Add a User to a MySQL Database Print

How to Add a User to a MySQL Database

After creating a MySQL database, the next step is to grant access to a user. This process ensures authorized users can interact with the database while maintaining security.

Prerequisites:

  • An existing MySQL database (if you haven’t created one yet, follow this guide first).
  • Access to cPanel (or your hosting control panel).

Step 1: Access MySQL Users in cPanel

  • Log in to your cPanel account.
  • Under the Databases section, click MySQL® Databases.
  • Scroll down to the MySQL Users section.

Step 2: Create a New MySQL User

  • In the Username field, enter a name for the new user.

Note: The username will automatically include your cPanel account prefix (e.g., cpaneluser_dbadmin).

  • Enter a strong password in the Password field.

Best Practice: Use a password manager to store credentials securely.

  • Click Create User.

Step 3: Assign the User to a Database

  • After creating the user, click Go Back to return to the MySQL Databases page.
  • Under Add User to Database, select:

The User you just created from the dropdown > The Database you want to grant access to.

  • Click Add.

Step 4: Set User Privileges

  1. On the Manage User Privileges page, select the appropriate permissions.

For full control (e.g., for a developer or admin), check ALL PRIVILEGES > For restricted access (e.g., read-only), select only necessary permissions.

  1. Click Make Changes to apply.

Step 5: Verify the User Was Added Successfully

A confirmation message will appear, indicating the user has been added to the database with the assigned privileges.

Need Expert Assistance?

If you encounter any issues, Vivint Host’s 24/7 support team is here to help. Our high-performance cloud hosting ensures your databases run securely and efficiently.

For more database management guides, visit our Knowledge Base or contact support anytime.


Was this answer helpful?

0 Users Found This Useful (0 Votes)
« Back