HostSEO Blog

Stories and News from IT Industry, Reviews & Tips | Technology Blog


How to empty a MySQL database

  • Category : MySQL Question
  • Posted on : Aug 18, 2021
  • Views : 633
  • By : HostSEO

There are two ways to empty a MySQL database: via phpMyAdmin and SSH.


NOTE 1: By default, SSH access is disabled on all our shared servers. If you need SSH to be enabled, contact our Hosting support via Live Chat or submit a ticket to the Hosting department.


NOTE 2: We recommend making a backup of your database before proceeding with any changes.



Using phpMyAdmin

To empty a database follow these steps:

1. Go to cPanel >> Databases section >> phpMyAdmin menu.
 
You can quickly access phpMyAdmin using cPanel Shortcuts in the Namecheap account.




2. Select the database you wish to empty. A list with all the database tables will appear on the left (you may have just one database if only one website is hosted):







3. Tick Check All to select all tables and choose the Drop option from the With selected drop-down list:




4. This will execute the DROP TABLE SQL query to empty all the tables at once. On the next step, confirm you wish to proceed by clicking the Yes button:






Using SSH

When you have a large database, it can be quicker to drop the database via SSH:


1. First, check if the database user has the privileges to Drop and Create. Go to cPanel > Databases section > MySQL Databases menu:




2. Find the database you wish to drop and click the assigned username:




3. You will see what privileges this user has. Make sure Drop and Create options are selected.
If these options are not ticked, select them and click Make Changes:




3. Connect to the hosting account via SSH. You can find the detailed instructions here.


4. Once connected, run the following command:

mysql -uUsername -pPassword


where:

Username - the MySQL user assigned to the database you are working with.
Password - password for the MySQL user.

5. You should receive the following output:




6. To drop the database run this command:

 drop database database_name 

where database_name is the name of your database:







That's it!




Need any help? Contact our HelpDesk

 

Subscribe Now

10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!

Archive Calendar

SatSunMonTueWedThuFri
 12345
6789101112
13141516171819
20212223242526
27282930 

Born in 2004 ... Trusted By Clients n' Experts

SEO Stars

They never made me feel silly for asking questions. Help me understand how to attract more people and improve my search engine ranking.

Read More

Emily Schneller Manager at Sabre Inc
SEO Stars

Took advantage of Hostseo's superb tech support and I must say, it is a very perfect one. It is very fast, servers reliability is incredible.

Read More

Leena Mäkinen Creative producer
SEO Stars

We're operating a worldwide network of servers with high quality standards requirements, we’ve choose hostseo to be our perfect partner.

Read More

Ziff Davis CEO at Mashable
SEO Stars

It’s very comfortable to know I can rely about all technical issues on Hostseo and mostly that my website and emails are safe and secured here.

Read More

Isaac H. Entrepreneur
SEO Stars

With hostseo as a hosting partner we are more flexible and save money due to the better packages with great pricing, free SEO n' free SSL too!

Read More

Madeline E. Internet Professional