How to Create a Database in cPanel (The Full Setup)

Summarize with:
Share:
HostingB2B Knowledgebase banner

Creating a database is a fundamental step for launching most modern websites and applications. However, simply creating the database is not enough. For it to be useful, you also need to create a dedicated user and grant that user the correct permissions. This guide provides a complete cPanel database setup walkthrough, ensuring you have a fully functional MySQL database ready for your project.

Step 1 Create a New MySQL Database in cPanel

The first stage of the process is to create the empty database itself. This acts as the container for all your application’s data, such as posts, user information, and settings. Follow these simple actions to complete the cPanel database creation.

  1. First, log into your cPanel account provided with your secure Web Hosting plan.
  2. Navigate to the Databases section and click the MySQL Databases icon.
    cPanel MySQL Databases icon which opens the Databases section to create or manage MySQL databases
  3. In the New Database field, enter a name for the database you wish to create. Your cPanel username and an underscore will be automatically prefixed to this name.
  4. Finally, click the Create Database button to complete the action.

You will see a success message confirming that the database has been added. Now you have an empty database, but you need a user to access it.

cPanel confirmation graphic showing "Database added successfully" after creating a database

Step 2 Create a cPanel Database User

A database user is a separate credential that your application will use to connect to the database. Creating a unique user for each database is a critical security practice. It isolates access and helps prevent a compromise in one application from affecting others.

  1. On the same MySQL Databases page, scroll down to the MySQL Users Add New User section.
  2. Enter a unique username in the Username field. Like the database name, this will also be prefixed with your cPanel account name.
  3. Enter a strong password in the Password field, or use the built-in Password Generator for maximum security. Be sure to copy and save this password in a secure location, as you will need it later.
  4. Click the Create User button.

With the user created, the final step is to connect the user to the database and grant it the necessary permissions.

Step 3 Assign User Privileges to Your Database

This final step authorizes the new user to perform actions on the database you created. Without assigning privileges, the user cannot read, write, or modify any data, rendering the database unusable for your application.

  1. Scroll down to the Add User To Database section on the same page.
  2. Select the user you just created from the User dropdown menu.
  3. Select the new database from the Database dropdown menu.
  4. Click the Add button.
  5. You will be taken to the Manage User Privileges screen. For most web applications like WordPress, you should check the box next to ALL PRIVILEGES.
  6. Click the Make Changes button at the bottom of the page to save the permissions.

Congratulations. You have successfully completed the full cPanel database setup. Your database name, username, and password are now ready to be used in your application’s configuration file.

Best Practices for Managing cPanel Databases

Proper management is key to performance and security. While granting all privileges is common for setup, for high-security environments, you should later refine permissions to the minimum required. Always use strong, unique passwords for each database user. For more advanced protection, review common security risks and solutions for your databases. If you ever need to remove a database, you can learn how to safely delete a database in cPanel.

Frequently Asked Questions

What is a MySQL database used for?

A MySQL database is used to store and manage data in a structured way for websites and applications. This includes content for a blog, user accounts for an online store, or product information for a catalog.

Do I need a new user for every database?

Yes, it is a strong security best practice to create a unique database user for each database. This isolates access so that if one application is compromised, the attacker cannot access the data of your other applications.

What are privileges in a database?

Privileges are permissions that define what actions a specific user can perform on a database. This includes actions like selecting data (reading), inserting data (writing), deleting data, and altering the database structure.

Where can I find my database details for my application?

You can find the full database name and the associated user on the MySQL Databases page in cPanel. The password is the one you created and saved during the user creation step. These three pieces of information are required for your application’s configuration file.

Can I use the cPanel Database Wizard instead?

Yes, cPanel offers a MySQL Database Wizard that guides you through these same three steps in a sequential process. The end result is identical, but following the manual steps on the main page can help you better understand how the components are related.

© 2025 All Rights Reserved. HostingB2B

Hosting B2B LTD is a Company registered in Cyprus with Company number HE410139 and VAT CY10410139C

Contact Info

© 2025 All Rights Reserved. HostingB2B