. . .

How to Manage Databases in cPanel.


Managing databases is a crucial aspect of website administration. cPanel offers robust tools for handling databases, including MySQL and phpMyAdmin. This guide will provide a comprehensive overview of how to manage databases in cPanel.

Step 1: Accessing Database Management Tools. (Best VPS provider)

Log in to cPanel with your username and password.
Navigate to the “Databases” section in the dashboard.
You will find tools such as MySQL Databases, MySQL Database Wizard, and phpMyAdmin.

Step 2: Creating a New Database

Using MySQL Databases:

Click on “MySQL Databases.”
Enter a name for the database in the “Create New Database” field.
Click “Create Database.”

Using MySQL Database Wizard: (Free Windows VPS Server)

Click on “MySQL Database Wizard.”
Enter the new database name and click “Next Step.”
Create a database user by entering a username and password, then click “Create User.”
Assign privileges to the user for the new database by selecting the desired privileges or clicking “All Privileges,” then click “Next Step.”

Step 3: Managing Database Users

Adding a New User:

In the MySQL Databases tool, find the “Add New User” section.
Enter a username and password for the new user.
Click “Create User.”

Assigning Users to Databases: (Best Web Hosting in India)

In the “Add User to Database” section, select a user and a database from the dropdown menus.
Click “Add” and assign the necessary privileges to the user.

Step 4: Using phpMyAdmin for Advanced Database Management

Accessing phpMyAdmin:

Click on “phpMyAdmin” in the Databases section of cPanel.
phpMyAdmin will open in a new tab.

Navigating phpMyAdmin:

Select the database you want to manage on the left sidebar.
Use the top menu tabs to perform various tasks like browsing tables, running SQL queries, and importing/exporting data.

Running SQL Queries: (Low cost VPS hosting)

Click on the “SQL” tab.
Enter your SQL query in the text area and click “Go” to execute it.

Importing Data:

Select the database and click on the “Import” tab.
Choose a file to import (e.g., .sql file) and configure the import settings.
Click “Go” to start the import process.

Exporting Data:

Select the database or table you want to export and click on the “Export” tab.
Choose the export method (Quick or Custom) and the format (e.g., SQL, CSV).
Click “Go” to download the exported file.

Step 5: Performing Database Backups

Manual Backup Using phpMyAdmin: (dedicated server hosting)

In phpMyAdmin, select the database to back up.
Click on the “Export” tab, choose the export options, and click “Go” to download the backup file.

Automatic Backup Using Cron Jobs:

Schedule a cron job in cPanel to automate database backups:
# [ /usr/bin/mysqldump -u dbuser -p’password’ dbname > /home/username/backups/db_backup.sql ]

This command will back up the database to the specified file location.

Step 6: Restoring Databases.

Using phpMyAdmin:

In phpMyAdmin, select the database you want to restore or create a new one.
Click on the “Import” tab, choose the backup file, and click “Go” to restore the data.

Using Command Line (for Advanced Users): (Free VPs Provider in India)

Access the server via SSH and use the following command to restore a database:
# [ mysql -u dbuser -p’password’ dbname < /path/to/db_backup.sql ]


cPanel provides a user-friendly interface for managing databases, including creating new databases, managing users, running SQL queries, and performing backups and restores. By utilizing the MySQL Databases tool, MySQL Database Wizard, and phpMyAdmin, you can effectively handle all your database needs.