# How to create a MySQL database, user, and assign privileges

> Canonical: https://jethost.com/kb/creating-a-mysql-database-and-user-in-cpanel/ · Last modified: 2026-09-08T11:01:26+00:00

MySQL is a popular database system that powers many websites and applications. In this guide, you’ll learn how to create a new MySQL database in cPanel, add a database user, and grant the user access to the database. All steps are in one streamlined process.

## Step 1: Access the MySQL Databases in cPanel

1. Log in to your cPanel account.
2. From the home screen, scroll down to the **Databases** section.
3. Click **Manage My Databases**.

This section lets you create new databases and manage existing ones.

## Step 2: Create a new MySQL database

1. In the **Create New Database** field, enter a descriptive name for your database. Your account username is automatically prepend (e.g., `accountname_db1`).
2. Click **Create Database**. A success message confirms your database has been created.

## Step 3: Create a MySQL user

1. Scroll down to the **MySQL Users** section.
2. Under **Add New User**, choose a username (note that cPanel may add a prefix).
3. Enter a strong password in both the **Password** and **Password (Again)** fields. We recommend including uppercase and lowercase letters, numbers, and symbols for better security.
4. Click **Create User**.

## Step 4: Assign the MySQL user to the database

1. In the **Add User To Database** section, select the newly created user from the **User** dropdown.
2. Select the newly created database from the **Database** dropdown.
3. Click **Add**.
4. On the privileges screen, check the box for **All Privileges** if you’re unsure which specific privileges your application requires (most web apps need full privileges).
5. Click **Make Changes** to finalize your updates.

## Step 5: Verify your setup

1. Return to the **Current Databases** section.
2. Confirm that the new database is listed alongside the user you just assigned.
3. Copy the database name, username, and password for your application’s configuration (e.g., `wp-config.php` for WordPress).

## Best practices

**Strong passwords**: Use complex passwords to help prevent unauthorized access.
**Descriptive names**: Label your databases and users in a way that helps you identify them later.
**Remove unused databases**: Deleting unneeded databases keeps your account clean and reduces potential security risks.
**Regular backups**: Always back up your databases before making large changes or updates.

This guide helps you quickly set up and manage your MySQL databases. If you have any questions or run into problems, contact our Support Team for further assistance.
