How to Create and Manage MySQL Databases in cPanel: A Complete Guide

If you run a WordPress site, a custom PHP application, or any dynamic website on a cPanel server, your content, user data, and configuration settings live inside MySQL or MariaDB databases. Knowing how to create, manage, and secure these databases from within cPanel is one of the most fundamental skills a site owner can develop.

cPanel’s MySQL management tools — MySQL Databases and phpMyAdmin — give you full control over database creation, user permissions, and direct table queries without needing command-line access. In this guide, you will learn how to create databases and users, assign privileges, import and export data, and follow security best practices to keep your database layer hardened.

Creating a MySQL Database and User in cPanel

Every web application needs at least one database and one database user. cPanel separates these steps cleanly so you can control exactly which user has access to which database.

Step 1: Create the Database

  1. Log into your cPanel dashboard (usually https://yourdomain.com:2083).
  2. Scroll to the Databases section and click MySQL Databases.
  3. Under Create New Database, enter a name for your database. cPanel will prefix it with your account username (for example, yoursite_wpdb).
  4. Click Create Database. A confirmation message will appear.
  5. Click Go Back to return to the main MySQL Databases page.

Step 2: Create a Database User

  1. In the MySQL Users section, enter a username and a strong password. Use the password generator for a 16+ character combination of letters, numbers, and symbols.
  2. Click Create User.

Step 3: Assign the User to the Database

  1. In the Add User to Database section, select the user and database you just created from the dropdown menus.
  2. You will be taken to the Manage User Privileges page.
  3. For most web applications (WordPress, Laravel, Joomla), select All Privileges. For custom applications, grant only the privileges the app needs (SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP are the minimum for a typical CMS).
  4. Click Make Changes.

Your database is now live. You can find its connection details — database name, username, and password — and use them in your application’s configuration file (such as wp-config.php for WordPress).

Managing Databases with phpMyAdmin

phpMyAdmin is a browser-based MySQL administration tool included with every cPanel installation. It lets you run SQL queries, browse tables, and perform bulk operations without writing a single line of code.

Accessing phpMyAdmin

  1. In cPanel’s Databases section, click phpMyAdmin.
  2. A new tab opens showing the phpMyAdmin interface. Your databases are listed in the left sidebar.
  3. Click any database name to see its tables.

Common Operations in phpMyAdmin

  • Browse data: Click a table name, then click the Browse tab to view rows.
  • Run SQL queries: Click the SQL tab and enter your query (for example: SELECT * FROM wp_options WHERE option_name = 'siteurl';).
  • Search across tables: Use the Search tab to find text inside a table’s data.
  • Repair or optimize tables: Select one or more tables, then use the dropdown below to choose Repair table or Optimize table.

Be cautious when making changes through phpMyAdmin. A single DROP TABLE or DELETE query without a proper WHERE clause can destroy data permanently. Always take a backup before running manual queries on a production database.

Importing and Exporting MySQL Databases

Moving databases between servers, restoring backups, or setting up local development copies all require reliable import and export workflows.

Exporting a Database (Backup)

  1. Open phpMyAdmin and click the database you want to export from the left sidebar.
  2. Click the Export tab at the top.
  3. Choose Quick for a full export of all tables, or Custom to select specific tables.
  4. Ensure the format is set to SQL (this produces a .sql file).
  5. Click Go. Your browser will download the file.

Importing a Database (Restore)

  1. Create an empty database in cPanel’s MySQL Databases section (do not add any tables).
  2. Open phpMyAdmin and select the empty database from the left sidebar.
  3. Click the Import tab.
  4. Click Choose File and select your .sql file. Files under 2 MB upload directly; for larger files, compress the SQL file as a .zip or .gz first.
  5. Click Go. phpMyAdmin will execute the SQL statements and recreate the tables and data.

If you encounter a “max_allowed_packet” or timeout error during import, ask your hosting provider to increase the limit in my.cnf, or split the SQL file into smaller chunks using a tool like split on the command line.

Resetting a MySQL Password in cPanel

Forgotten database passwords happen more often than you might expect. Fortunately, cPanel makes it simple to reset them without losing data.

  1. In cPanel, go to MySQL Databases.
  2. Scroll to the Current Users section.
  3. Find the user whose password needs resetting and click Change Password.
  4. Enter a new strong password or use the generator.
  5. Click Change Password to save.

Important: After resetting the password, update your application’s configuration file (like wp-config.php) with the new password. Your site will throw database connection errors until the credentials match.

MySQL Security Best Practices for cPanel Users

Databases are a prime target for attackers. A compromised database can leak customer information, user credentials, and payment data. Here is how to lock yours down.

Use Separate Users and Databases Per Application

Never reuse the same database user across multiple websites. If one site gets compromised, the attacker can pivot to every database the user has access to. cPanel makes it easy to create dedicated users per application — take advantage of it.

Grant Minimal Privileges

Do not give All Privileges unless the application genuinely needs it. For a read-only reporting tool, grant only SELECT. For a CMS, the standard SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP set is usually enough. Avoid granting SUPER or FILE privileges to routine application users.

Use Strong, Unique Passwords

cPanel includes a password generator for a reason. Database passwords should be at least 16 characters with a mix of cases, numbers, and symbols. Never use passwords shared with your email or cPanel login.

Change the Database Prefix

WordPress databases use the wp_ table prefix by default. Change it during installation (to something like site3_ or xyz123_) to protect against SQL injection attacks that assume the default prefix.

Regular Backups

Schedule automated backups of your MySQL databases. Most cPanel hosting plans include a backup tool that can create daily or weekly database dumps. Store copies off-site — a database backup on the same server is useless if the server itself goes down.

Key Takeaways

  • cPanel’s MySQL Database Manager and phpMyAdmin let you handle all database operations — creation, user management, import/export, and table manipulation — entirely from a browser.
  • Always create a separate database user for each application and grant only the privileges that application requires.
  • Use phpMyAdmin’s Export feature for quick database backups before making structural changes.
  • Reset forgotten MySQL passwords through the MySQL Databases page, then update your application config file immediately.
  • Compress large SQL files as .zip or .gz before importing to avoid phpMyAdmin upload limits.
  • Security fundamentals — unique users, minimal privileges, strong passwords, and regular off-site backups — are the most effective defense against database-level attacks.