How to Create and Manage MySQL Databases in cPanel

Estimated reading: 2 minutes

Overview

Most web applications — including WordPress, Joomla, Magento, and custom PHP scripts — require a MySQL database to store content and settings. cPanel makes it easy to create databases, database users, and assign permissions without needing to touch the command line.

Step 1 — Create a New Database

  1. Log in to your cPanel account.
  2. In the Databases section, click MySQL Databases.
  3. Under Create New Database, type a name for your database (e.g., mysite_db).
  4. Click Create Database.

Note: cPanel will automatically prefix the database name with your cPanel username (e.g., cpuser_mysite_db). This is normal.

Step 2 — Create a Database User

  1. Scroll down to MySQL Users.
  2. Under Add New User, enter a username and a strong password.
  3. Click Create User.

Like databases, the username will be prefixed automatically (e.g., cpuser_myuser).

Step 3 — Assign the User to the Database

  1. Scroll down to Add User to Database.
  2. Select your newly created user and your database from the dropdowns.
  3. Click Add.
  4. On the next screen, select All Privileges, then click Make Changes.

Your database is now ready to use. Use the full prefixed names (e.g., cpuser_mysite_db and cpuser_myuser) when connecting your application.

How to Manage Your Database with phpMyAdmin

cPanel includes phpMyAdmin, a web-based interface for managing your databases visually.

  1. In cPanel, click phpMyAdmin (under the Databases section).
  2. Select your database from the left sidebar.
  3. From here you can browse tables, run SQL queries, import/export data, and more.

How to Delete a Database

To remove a database you no longer need:

  1. Go to MySQL Databases in cPanel.
  2. Scroll to the Current Databases list.
  3. Click Delete next to the database you want to remove.
  4. Confirm the deletion.

⚠️ Warning: Deleting a database is permanent. Always take a backup first via phpMyAdmin (Export tab) before deleting anything.

WordPress Database Details

When connecting WordPress to your database, you will need to enter these details in wp-config.php:

  • DB_NAME: the full prefixed database name
  • DB_USER: the full prefixed database username
  • DB_PASSWORD: the database user’s password
  • DB_HOST: localhost (this is almost always correct on shared hosting)

Need help? Open a support ticket and our team will assist you.