A MySQL database is required for many websites and applications, such as WordPress, Joomla, Drupal, and other content management systems. Databases store important information like website content, user accounts, and settings.
This guide explains how to create a MySQL database in cPanel.
Step 1: Log in to cPanel
-
Open your web browser.
-
Go to your cPanel login page.
Example:
https://yourdomain.com/cpanel
-
Enter your cPanel username and password.
-
Click Log in.
Step 2: Open the MySQL Databases Tool
-
Scroll down to the Databases section.
-
Click MySQL Databases.
This page allows you to create and manage databases and database users.
Step 3: Create a New Database
-
Under Create New Database, enter a name for your database.
Example:
mydatabase
-
Click Create Database.
Your database will now be created.
Note: cPanel automatically adds your account prefix to the database name.
Example:cpanelusername_mydatabase
Step 4: Create a Database User
Next, create a user that will have permission to access the database.
-
Scroll down to the MySQL Users section.
-
Under Add New User, enter the following:
-
Username – the database user name
-
Password – create a strong password or click Generate Password
Example username:
dbuser
-
Click Create User.
Step 5: Assign the User to the Database
After creating the user, you must connect it to the database.
-
Scroll down to Add User to Database.
-
Select the User you created.
-
Select the Database you created.
-
Click Add.
Step 6: Set User Privileges
-
Select All Privileges to allow the user full access to the database.
-
Click Make Changes.
Your database and user are now fully configured.
Using the Database with Your Website
When installing a script or application, you will usually need to provide the following information:
-
Database Name
-
Database Username
-
Database Password
-
Database Host (usually localhost)
These details allow the application to connect to the database.
Managing Your Database
You can manage your database using phpMyAdmin in cPanel.
phpMyAdmin allows you to:
-
View database tables
-
Edit records
-
Import or export databases
-
Run SQL queries
-
Create backups
To access it:
-
Go to the Databases section in cPanel.
-
Click phpMyAdmin.
Tips for Database Management
-
Use strong passwords for database users.
-
Keep regular database backups.
-
Avoid deleting databases unless you are sure they are no longer needed.
-
Record your database credentials when installing applications.
If you need assistance creating or managing a MySQL database, please contact our support team and include any error messages or screenshots so we can assist you further.