Learn to Empty a MySQL Database in Simple Steps
You can empty the content of a MySQL database Using phpMyAdmin or SSH. But you have to make sure that you take a backup of your database (phpMyAdmin or SSH) before making any changes to your databases.
Empty a MySQL Database Using phpMyAdmin
As compared to other ways this is the easiest way to empty a MySQL database .
Login to your cPanel account and navigate to Databses and select phpMyAdmin
Then select the database you which you wish to empty.
All the database’s tables list will get appeare. click on Check All link for selecting all the tables in the database
Next, from drop down menu of “With Selected” select drop. With this, on all tables the DROP TABLE SQL query will run and after you make sure that you wish to move futher by clicking on Go, the database will be emptied.
Empty a MySQL Database Using SSH
Using SSH, when you drop the content of a database, in terms large databases it proves to be very useful. Here you will required to use the drop and create privilege ( or lese you will drop the database but won’t be able to create it again).
- Navigate to MySQL with your database MySQL user by executing the command over SSH as mention below:
mysql -uUSERNAME -p
Keep in mind to replace USERNAME with your MySQL user and your password when prompted.
- Then run the DROP and CREATE commands as mention below:
mysql> DROP database DATABASE_NAME;
mysql> CREATE database DATABASE_NAME;
In this the, the name of your database will be DATABASE_NAME.
In this way Using phpMyAdmin and SSH you can empty a MySQL database in simple steps.