Home / Blog / Web Hosting / How to Create a MySQL Database in cPanel
How to Create a MySQL Database in cPanel
Web Hosting

How to Create a MySQL Database in cPanel

Before installing WordPress, Joomla, or any PHP-based application, you need a MySQL database. cPanel makes this process straightforward. Here's how to create a database, add a user, and assign the correct permissions — all in under two minutes.

Step 1 — Open MySQL Databases

  1. Log in to your cPanel account.
  2. Scroll to the Databases section.
  3. Click MySQL Databases.

Step 2 — Create the Database

  1. Under Create New Database, enter a database name (e.g., wordpress).
  2. Click Create Database.

Your full database name will be cpanelusername_wordpress (cPanel prefixes your username automatically).

Step 3 — Create a Database User

  1. Scroll to MySQL Users → Add New User.
  2. Enter a username (e.g., wpuser) and a strong password.
  3. Use the Password Generator for a secure password — copy it somewhere safe.
  4. Click Create User.

Step 4 — Add User to Database

  1. Scroll to Add User to Database.
  2. Select the user (cpanelusername_wpuser) and the database (cpanelusername_wordpress).
  3. Click Add.
  4. On the next page, check ALL PRIVILEGES.
  5. Click Make Changes.

Your Database Details

Note these details — you'll need them when configuring your application:

SettingValue
Database Hostlocalhost
Database Namecpanelusername_wordpress
Database Usercpanelusername_wpuser
PasswordThe password you set in Step 3

Verify via Terminal (Optional)

If you have SSH access, verify the database was created:

mysql -u cpanelusername_wpuser -p -e "SHOW DATABASES;"

You should see cpanelusername_wordpress in the list.

You're now ready to install WordPress or import your SQL backup. Check out our guide on how to restore a SQL database in cPanel using the terminal to import your data.