How to clear a MySQL database

May 1, 2023 / MySQL

In this article, we will explain how to clear your MySQL database with the help of two different ways: SSH and phpMyAdmin.

Using SSH

Here,  we will use SSH to access the empty MySQL database:

  1. Log into your cPanel account as a “root user”.
    Login to cPanel Account
  2. Search for the Databases” section and click on the MySQL Databases” option.
    MySQL Database
  3. The next step is to choose the database to drop in and then select the assigned “username”.
    Choose database
  4. Here you will find “Manage User Privileges”, be careful to choose the “Drop” and “Create” options.
    Manage User Privilieges
  5. Now, connect to your hosting account with the help of SSH.
  6. Run the following “Command”.
    mysql -uUsername -pPassword
  7. Run this command line on Shell “mysql -uABC -,GIuHYHTN6@Q”
    run the command
  8. Execute this command to remove the database:
    drop database database_name
    Execute the command
    That’s it! Now, here we will go with the second method which is phpMyAdmin

Using phpMyAdmin

Follow the below steps  to empty a database –

  1. Log into your cPanel account as “root users”.
    Login to cPanel - root users
  2. Search for the “Databases” section and click on the “phpMyAdmin”.
    phpMyAdmin
  3. A list of all the database tables will be available.
    Choose the Database
  4. Choose all tables by clicking on the “Check All” Option, then select the “Drop” menu:
    Choose the all tables
  5. Confirm your decision to move on by selecting “Yes”.
    Execute this Drop query

In this way, you can use SSH and phpMyAdmin to empty your database. I hope you understood this article. For more details, please visit our KB section.

Also Read : How to Backup a MySQL Database using phpMyAdmin

Spread the love