How to Create a MySQL Database in cPanel

Create a MySQL database, database user, and assign privileges in cPanel so your website or application can store and retrieve data.

How-To 5 min read Updated 2026-03-05 Beginner Cynet Support

Quick Answer

Log in to cPanel → Databases → MySQL Databases → Enter a database name and click Create Database → Scroll down to create a new MySQL user with a strong password → Assign the user to the database with 'All Privileges' → Click Make Changes. Your database is ready to use.

Most websites and applications — WordPress, Joomla, Laravel, custom PHP apps — require a MySQL database to store content, user data, and settings. This guide walks you through creating a database, a database user, and linking them together in cPanel.

What You'll Create

ComponentPurpose
DatabaseThe container that stores your website's data (tables, rows, columns)
Database UserThe account used to connect to and interact with the database
PrivilegesPermissions that define what the user can do (read, write, delete, etc.)
All three are required. A database without a user cannot be accessed by your application.

Steps

Step 1: Log in to cPanel

Navigate to yourdomain.com/cpanel or log in via the Cynet client area at manage.cynet.com.my → My Services → Web Hosting → Manage → cPanel Login.

Step 2: Open MySQL Databases

In the cPanel dashboard, scroll to the Databases section and click MySQL Databases.

Step 3: Create a New Database

  1. Under Create New Database, enter a name for your database
- cPanel prefixes the name with your cPanel username (e.g., cpanelusermydb) - Keep the name short and descriptive (e.g., wordpress, shop, app)
  1. Click Create Database
  2. Click Go Back to return to the MySQL Databases page

Step 4: Create a Database User

  1. Scroll down to MySQL UsersAdd New User
  2. Enter a Username — this is also prefixed with your cPanel username
  3. Enter a Password — click Password Generator to create a strong, random password
  4. Save the generated password — you'll need it when configuring your application
  5. Click Create User
  6. Click Go Back
Important: The database user password is separate from your cPanel password. Use a unique password for each database user.

Step 5: Assign the User to the Database

  1. Scroll down to Add User To Database
  2. Select the User you just created from the dropdown
  3. Select the Database you just created from the dropdown
  4. Click Add

Step 6: Set Privileges

  1. On the privileges page, check ALL PRIVILEGES to grant full access
  2. Click Make Changes
For most websites and applications, All Privileges is the correct choice. If you need restricted access for security (e.g., a read-only user), select only specific privileges.

Step 7: Done

Your database is ready. Note down these details — you'll need them when configuring your website or application:

SettingValue
Database Namecpaneluseryourdbname (full name including prefix)
Database Usercpaneluseryourusername (full name including prefix)
Database PasswordThe password you set in Step 4
Database Hostlocalhost

Using the Database in Your Application

WordPress (wp-config.php)

When installing WordPress manually, enter these values in wp-config.php:

define('DBNAME', 'cpaneluseryourdbname');
define('DBUSER', 'cpaneluseryourusername');
define('DBPASSWORD', 'yourdatabasepassword');
define('DBHOST', 'localhost');
Tip: If you install WordPress via Softaculous or WP Toolkit, the database is created automatically — you don't need to do this manually.

PHP Application

Connect to the database using PDO or MySQLi:

$host = 'localhost';
$dbname = 'cpaneluseryourdbname';
$user = 'cpaneluseryourusername';
$pass = 'yourdatabasepassword';

$pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $user, $pass);

Laravel (.env)

DBCONNECTION=mysql
DBHOST=localhost
DBPORT=3306
DBDATABASE=cpaneluseryourdbname
DBUSERNAME=cpaneluseryourusername
DBPASSWORD=yourdatabasepassword

Managing Your Database with phpMyAdmin

After creating the database, you can manage it (create tables, import data, run queries) using phpMyAdmin:

  1. Go to cPanel → DatabasesphpMyAdmin
  2. Select your database from the left sidebar
  3. From here you can:
- Import a .sql file to populate the database - Export the database as a backup - Create tables and manage structure - Run SQL queries directly - Browse and edit data

Importing an Existing Database

If you have a .sql database file to import (e.g., from a migration or backup):

  1. Open phpMyAdmin in cPanel
  2. Select the target database from the left sidebar
  3. Click the Import tab
  4. Click Choose File and select your .sql file
  5. Leave the default settings (Format: SQL)
  6. Click Go
Upload limit: phpMyAdmin typically allows files up to 50–100 MB. For larger databases, upload the .sql file via FTP and import via SSH: mysql -u username -p databasename < file.sql

Deleting a Database

If you no longer need a database:

  1. Go to cPanel → MySQL Databases
  2. Scroll to Current Databases
  3. Click Delete next to the database you want to remove
  4. Confirm the deletion
Warning: Deleting a database permanently removes all data. Create a backup first if you might need the data later.

Troubleshooting

"Error establishing a database connection"

  • Verify the database name, username, and password in your application's configuration file match exactly what's in cPanel (including the prefix)
  • Confirm the user is assigned to the database (Step 5)
  • Ensure the database host is set to localhost

"Access denied for user"

  • The user may not have been assigned to the database — go to MySQL Databases → Add User To Database
  • The password may be incorrect — reset it in MySQL Databases → Change Password
  • Privileges may not be set — reassign the user with All Privileges

Database not showing in phpMyAdmin

  • The database user may not have privileges — reassign the user to the database
  • Try logging out and back in to cPanel to refresh the session
  • Verify the database exists under Current Databases on the MySQL Databases page

"Can't create database — quota exceeded"

  • Your hosting plan has a maximum number of databases. Check your plan limits in the Cynet client area
  • Delete unused databases to make room, or upgrade your plan
MySQL database cPanel phpMyAdmin hosting

Need our team to handle this?

Running into a hosting issue you can't resolve? Submit a request and our engineers will help.

Was this article helpful?

Not sure which hosting plan is right for you?

Get a personalized recommendation in under 60 seconds.

Find the Right Plan