cPanel

How to Create a MySQL Database in cPanel

Create a MySQL database and user in cPanel and connect it to your website — step by step.

Many websites — including every WordPress site — store their content in a MySQL database. If you're installing a CMS manually, or setting up a script that needs its own database, here's how to create one in cPanel.

Why you create "a database" and "a user"

Web hosts split these into two pieces for security:

  • The database — where the data is stored.
  • The user — a username and password used to reach the data.
  • Privileges — the link that says "this user may access that database".

You create all three, then give your website the database name, username and password so it can connect.

Note: cPanel usually prepends your account prefix to database and user names, e.g. den_wpdb. Whatever it shows is the exact name you must use later.

How to create the database

  1. Log into cPanel.
  2. In the Databases section, click MySQL Databases.
  3. Under Create New Database, enter a name and click Create Database.

How to create the user

  1. On the same page, under Add New User, choose a username.
  2. Enter a strong password and click Create User.

How to attach the user to the database

  1. Under Add User to Database, pick your database and user from the dropdowns.
  2. Click Add.
  3. Tick ALL PRIVILEGES (or the specific privileges your app asks for) and click Make Changes.

Connect your website

Your application or install script will ask for four things — these all come from the steps above:

  • Database name (with the cPanel prefix)
  • Username (with the cPanel prefix)
  • Password
  • Host (usually localhost — keep the default value the installer suggests)

Installing WordPress manually? See How to Connect a MySQL Database to WordPress for where these go.

Was this article helpful?

Your feedback helps us improve our guides.

Still need a hand?

Contact WebFulHost Support — our team is available 24/7.