How to Create MySQL Database and User on cPanel

Almost every website needs to have a database on which all the data is stored. This tutorial will help you learn
how to create a database and user in cPanel. Every database also needs a username to access it so we will also mention here
how a username should be created.

What you’ll need

Before you begin this guide you’ll need the following:

  • Access to your cPanel

Step 1 — Logging into cPanel and selecting MySQL Databases

Access your cPanel and navigate to MySQL databases.

MySQL Databases

Step 2 — Entering database name

Database name should be entered in the input field (Name should be entered without spaces). Enter the name and press Create Database button.

Create database

Step 3 — Creating username

Scroll down and you will see Add New User section there. Enter username to the input field (Name should be entered without spaces). Enter your password and repeat it (Password generator button can be used to create a random password). Press Create User button afterwards.

Create username

Step 4 — Adding User To the Database

Below there is Add User To Database section. Here you should select User from the dropdown list which was just created and select the database to which it should be assigned. Press Add button.

Add user to database

After pressing the Add button, Step 5 picture of privileges appears on your screen so move to the next step.

Step 5 — Providing all the privileges

On this step just leave all the privileges selected and press Make Changes button.

Provide privileges


If everything was done correctly, you have successfully created a database, username and assigned that username to the database with all the privileges. It can now be used to access a database for any script or website you are developing. Please keep in mind this tutorial is used to create an empty database only. Tables and all the entries on them should be created manually or imported.

About the author

Edvinas B.

Edvinas mentors and trains every new customer support agent at Hostinger. When he's not teaching new guys the secrets of providing an exceptional service, he likes to travel the world and play basketball.

Add Comment

Click here to post a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get Exclusive Content

Join thousands of webmasters who get our free newsletter with tips on how to drive more traffic and revenue to their websites!

Please wait...

Thank you for sign up!