Skip to content

How can I create a new MySQL user and assign it to a database?

Creating a new MySQL user and assigning it to a database in cPanel is straightforward. Follow these steps to complete the process:

  • Open your web browser and navigate to your cPanel login page.
  • Enter your username and password to log in.
  • In the cPanel dashboard, locate the “Databases” section.
  • Click on the “MySQL Databases” icon.
  • Scroll down to the “MySQL Users” section.
  • In the “Add New User” subsection:
    • Username: Enter a username for the new MySQL user.
    • Password: Enter a strong password for the new user.
    • Password (Again): Re-enter the password to confirm it.
  • Click the “Create User” button.
  • Scroll down to the “Add User To Database” section.
  • In the “User” dropdown menu, select the newly created MySQL user.
  • In the “Database” dropdown menu, select the database to which you want to assign the user.
  • Click the “Add” button.
  • After adding the user to the database, you will be prompted to set the user’s privileges.
  • Select the privileges you want to grant to the user (typically, you will select “ALL PRIVILEGES”).
  • Click the “Make Changes” button to apply the privileges.
  • Naming Conventions:
    • Use clear and consistent naming conventions for your databases and users to avoid confusion.
  • Strong Passwords:
    • Always use strong, unique passwords for your database users to enhance security.
  • Database Management:
    • Use phpMyAdmin, accessible from cPanel, to manage your databases, run SQL queries, import/export data, and more.

By following these steps, you can successfully create a new MySQL user and assign it to a database in cPanel.