Databases

MySQL Databases

Updated: 09 February 2024
cPanel Version: 118

MySQL® Databases is a powerful tool found on the cPanel of your web hosting account that allows you to create, modify, and manage your MySQL databases. This tutorial will guide you through the process of handling MySQL Databases Menu on cPanel.

Accessing MySQL Databases on cPanel

To start, you'll need to log into your cPanel account. Once you're in, follow these steps:

  1. Scroll to the Databases section.
  2. Click on the MySQL Databases icon.

Now, you should be looking at the MySQL Databases menu.

Creating a Database

Creating a new database is straightforward. Here's how to do it:

  1. In the Create New Database section, enter your desired database name.
  2. Click Create Database.
  3. You will see a confirmation message. Click Go Back to return to the main MySQL Databases page.

IMPORTANT!

Don’t use phpMyAdmin to create databases or database users. phpMyAdmin doesn’t map databases, which causes backups and restorations to not function.

Check a Database

  1. Go to the Check Database menu.
    • Select the database you want to check.
  2. Click on the Check Database button. You'll see a new page, and the system will start checking if the database works fine.
    • If there's an issue, you'll see the name of the problem table.
    • If you see a Check Complete message, your database is good to go.
  3. Click Go Back to return to the main page.

Repair a Database

  1. Go to the Repair Database menu.
    • Choose the database you need to fix.
  2. Click on the Repair Database button. A new screen will show up, and the system will try to fix the database by itself.
    • If the system can't fix it, it will look for what's causing the problem.
    • If you see a Repair Complete message, the database is fixed.
  3. Click Go Back to go back to the main screen.

Rename a Database

  1. In the Current Databases table, click Rename next to the database you want to change the name of.
  2. Type the new name for the database in the New name text box.
  3. Click Proceed.

Please Remember!

You must manually update configuration files and applications to use the new database name.

Note

MySQL doesn't actually let you change a database's name directly. When you use cPanel & WHM to "rename" a database, here's what really happens:

  1. The system makes a new database.
  2. It then moves all the data from the old database to the new one.
  3. Next, it sets up the necessary permissions and stored procedures or code in the new database.
  4. Finally, it gets rid of the old database and its permissions.

Creating a User

After creating a database, you will need a user to interact with the database. Let's create a new user:

  1. Scroll to the MySQL Users section.
  2. In the Add New User section, enter a username and password.
  3. Click Create User.

Assigning a User to a Database

A user needs to be assigned to a database to interact with it. Here's how:

  1. Scroll to the Add User To Database section.
  2. Select your user and database from the dropdown menus.
  3. Click Add.
  4. Select the privileges you want to give to the user, then click Make Changes.

Modifying a Database

If you need to modify your database, use phpMyAdmin:

  1. Return to the main cPanel page.
  2. Scroll to the Databases section and click 'phpMyAdmin'.
  3. Select your database from the left-hand column.
  4. Use the tabs at the top of the page to select the action you want to perform.

External links

MySQL® Databases - cPanel Documentation