Create MySQL Databases and users in cPanel

  Shared hosting

Create MySQL Databases and users in cPanel

Date: 25-Oct-2019

Introduction

This guide explains how to create a MySQL database and database users in cPanel and how to assign the necessary privileges so users can access and manage the database.

Prerequisites

  1. Valid cPanel login credentials
  2. Access to the Databases section in cPanel
  3. Basic understanding of databases and users
  4. Implementation
  5. Creating a Database in cPanel

Creating a database in cPanel

Step 1:

  1. Log in to your cPanel account and navigate to the DATABASES section.
  2. Then click on MySQL Databases.

Step 2:

  1. In the new interface, locate the New Database field.
  2. Enter the desired database name.

The database name is automatically prefixed with your cPanel username.
Example: If the username is democom and the database name is test, the final name will be democom_test.

Step 3:

  1. Click Create Database.
  2. A success message will confirm database creation.
  3. Verify the database under the Current Databases section.
  4. Creating a Database User

So, we have successfully created a new database now!!!.

    Let us now create a database user to access the database.

    Creating a database user

    Step 1:

    Navigate to MySQL Users → Add New User.

    Step 2:

    1. Enter the username for the database user.
    2. The username will also be prefixed with your cPanel username.
      Example: democom_test

    Step 3:

    1. Enter a strong password twice or use the Password Generator.

    Step 4:

    1. Click Create User.
    2. The user will appear under the Current Users section.
    3. Adding a User to the Database

    Adding a user to the database

    Step 1:

    1. Go to Add User To Database under the MySQL section.

    Step 2:

    1. Select the user from the User dropdown
    2. Select the database from the Database dropdown
    3. Click Add

    Step 3:

    Assign privileges:

    1. Select ALL PRIVILEGES for full access Or choose specific privileges as required
    2. Click Make Changes

    Conclusion

    By following these steps, you can successfully create a MySQL database, create a user, and assign appropriate privileges in cPanel. This ensures secure and controlled access to your database.

    LEAVE A COMMENT