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
Log in to WHM.
Navigate to MySQL Databases in the left-hand sidebar.
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.
Click Create.
Assign a MySQL user to the database
In the MySQL Databases interface, scroll down to the Add privilege to new or existing MySQL user section.
Select the database you just created from the New MySQL Database dropdown.
Select the appropriate user from the MySQL User dropdown.
Click Add.
In the Privileges section, select the permissions you wish to grant the user (e.g., Select, Insert, Update, Delete).
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.
