Skip to main content

How to Create a MySQL Database for a cPanel Account in WHM

Create a MySQL database for a specific cPanel account using the WHM interface. This procedure allows a server administrator to provision a database and assign it to a user account.

Create a MySQL database for a specific cPanel account using the WHM interface. This procedure allows a server administrator to provision a database and assign it to a user account.

Before you begin

You will need:

  • Root access to the WHM interface

  • The specific cPanel account name or username

  • The desired database name and a unique username for the database

Create the MySQL database

  1. Log in to WHM.

  2. Navigate to MySQL Databases in the left-hand sidebar.

  3. Under the Create a New MySQL Database section, enter the following details:

    • New MySQL Database: Enter the name of the database (e.g., example_db).

    • MySQL User: Select the cPanel account's user from the dropdown menu.

    • Proposed Hostname: Leave this as the default value (usually localhost) unless you have a specific reason to change it.

  4. Click Create.

Assign a MySQL user to the database

  1. In the MySQL Databases interface, scroll down to the Add privilege to new or existing MySQL user section.

  2. Select the database you just created from the New MySQL Database dropdown.

  3. Select the appropriate user from the MySQL User dropdown.

  4. Click Add.

  5. In the Privileges section, select the permissions you wish to grant the user (e.g., Select, Insert, Update, Delete).

  6. Click Apply.

Confirm the result

  • The new database will appear in the list of MySQL databases.

  • The assigned user will appear in the list of MySQL users with the associated privileges.

  • You can verify the connection by logging into the cPanel account and checking the database status.

Limitations

This procedure creates the database at the server level. If the cPanel account is moved to a different server, the database and its associated user must be migrated as part of the account transfer.

Did this answer your question?