Black Friday Sale is live: save up to 85% on Web & WordPress HostingView Deals
Support Knowledge BaseApplication & Server Management

How to Create a MySQL Database and User in cPanel

Direct Answer

Every web application that stores data � WordPress, WooCommerce, Laravel, Joomla, or a custom PHP site � needs a MySQL database. In cPanel, you create the database, create a user with a password, and then assign that user to the database before providing the credentials to your application.


Step 1: Open MySQL Databases in cPanel

  1. Log in to cPanel via your client portal or direct panel link.
  2. Navigate to Databases > MySQL Databases.

Step 2: Create a New Database

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

    cPanel automatically prefixes the name with your cPanel username. So wordpress becomes username_wordpress. Note this full name � you will need it in your application config.

  2. Click Create Database.
  3. cPanel confirms: “The database username_wordpress has been created.”

Step 3: Create a Database User

The database needs a dedicated user with a password. Do not use your cPanel login for this.

  1. Scroll down to MySQL Users > Add New User.
  2. Enter a username (e.g., wpuser, appuser).
  3. Enter a strong password or click Password Generator.
  4. Click Create User.

Note the exact username that cPanel shows (it will have your cPanel prefix, e.g., username_wpuser).


Step 4: Assign the User to the Database

Creating the user and database separately means they are not yet connected. You must explicitly link them:

  1. Scroll down to Add User To Database.
  2. Select the user from the User dropdown.
  3. Select the database from the Database dropdown.
  4. Click Add.
  5. On the privileges screen, click All Privileges then click Make Changes.

The database user now has full read/write access to that specific database.


Step 5: Note Your Credentials

Before leaving cPanel, note these four values � you will enter them in your application’s config file:

Setting Value
Database Name username_databasename (full name with prefix)
Database User username_dbuser (full username with prefix)
Database Password The password you set in Step 3
Database Host localhost (for shared hosting)

For WordPress, these go into wp-config.php:

define( 'DB_NAME',     'username_wordpress' );
define( 'DB_USER',     'username_wpuser' );
define( 'DB_PASSWORD', 'your-password-here' );
define( 'DB_HOST',     'localhost' );

Import an Existing Database

If you are migrating a site and have a .sql export file:

  1. In cPanel, go to Databases > phpMyAdmin.
  2. Click the target database name in the left panel.
  3. Click the Import tab at the top.
  4. Click Choose File and select your .sql file (up to 50 MB via browser).
  5. Click Go.

For databases larger than 50 MB, open a support ticket requesting a command-line import � paste the database name and attach the file or share a download link through the secure ticket portal.


Optimise Your Database

Over time, WordPress and WooCommerce databases accumulate auto-draft revisions, expired transients, and orphaned data that slow query performance. See the MySQL optimisation guide in phpMyAdmin for a step-by-step cleanup.


Need Help?

If your application cannot connect to the database after following these steps, open a support ticket with your domain name and the connection error message. The support team can verify the database, user, and privilege configuration directly.

Frequently Asked Questions

How many MySQL databases can I create in cPanel?

The number of databases allowed depends on your hosting plan. Most standard shared hosting plans allow 10 to unlimited databases. Check your plan's resource limits in cPanel under MySQL Databases, which shows current usage against the allowed maximum.

What privileges should I assign to a WordPress database user?

For WordPress, assign All Privileges to the database user. This grants SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, and ALTER permissions that WordPress core, plugins, and themes require during installation and updates.

Can I access and manage my database without command line?

Yes. phpMyAdmin is available in cPanel under Databases > phpMyAdmin. It provides a full graphical interface for browsing tables, running queries, importing SQL files, and exporting database backups without any command-line knowledge.

What should I do if my application returns a database connection error?

Verify three things: the database name, the database username, and the password match exactly what is in your application config file (wp-config.php for WordPress). Also confirm the database user has been assigned privileges to the correct database in cPanel MySQL Databases.

How do I import an existing database backup into cPanel?

In cPanel, open phpMyAdmin, select the target database from the left panel, click the Import tab, choose your .sql file (under 50 MB), and click Go. For files larger than 50 MB, ask the support team to import via command line by opening a support ticket.

Need Technical Assistance?

Web Hosting Wale support is available 24/7. Tickets are typically answered within 10-15 minutes.

Open Support TicketView All Support Channels