How Can We Help?
< All Topics
Print

Mastering MySQL Databases in cPanel: A Comprehensive Guide

MySQL is a widely used open-source SQL database management system that efficiently stores large amounts of data in tables. It allows for the creation and management of existing MySQL databases. For PHP-based applications, creating a database and database user is necessary. For CMS like WordPress, Drupal, and Joomla, a MySQL database is required.

a) How to create a new database in cPanel

1. Log into cPanel and navigate to the Databases section to select MySQLDatabases tool or search for the MySQLDatabases tool in the search bar.

MySQL

2. Then, enter the name of the database you want to create and click the Create Database button.

3. Finally, you will receive the message that the database has been added. Note: cPanel automatically adds a prefix to the name, ensuring no ambiguity in shared hosting environments. Two databases cannot have the same name, so the name becomes Prefix_dbName. When connecting a database to a web application, you need to use the full name of the database.

b) How to add a database user in cPanel

1. Log into cPanel and navigate to the Databases section to select MySQLDatabases tool or search for the MySQLDatabases tool in the search bar.

2. Then, scroll down to the end and locate MySQL Users under the Add New User section to add a new user to the MySQL database.

3. After that, enter your desired username and strong password. Click Create User and you’ll receive a success message. Note: The full username of the database user includes the prefix and the username you provided.

4. Next, scroll down to find “Add user to database” to add a user to access the database.

5. Then, select the user and database you want to associate and click the Add button.

6. Finally, check the ALL PRIVILEGES checkbox and all checkboxes will automatically be checked to provide all privileges to the user. Click “Make changes” to save your changes.

c) How to check a database in cPanel

1. Log into cPanel and navigate to the Databases section to select MySQLDatabases tool or search for the MySQLDatabases tool in the search bar.

2. Then, select the desired database to check from the Check Database drop-down menu in the Modify Database section.

3. After that, click on the “Check Database” button.

4. Finally, cPanel will now run an automated script to find corrupted tables in the database. If a corrupt table is found, the name of the table is displayed; otherwise, a success message is displayed.

c) How to repair a database in cPanel

1. Log into cPanel and navigate to the Databases section to select MySQLDatabases tool or search for the MySQLDatabases tool in the search bar.

2. Then, select the database with corrupt data from the drop-down menu in the Modify Databases section.

3. Then, click the Repair Database button.

4. Finally, cPanel executes an automated script to repair corrupted data or tables in the database, displaying a success message if successful and an error message if the repair fails.

Table of Contents