What is the command to delete all tables in MySQL?

To delete all tables in MySQL, you can use the following command: 1. Enter the MySQL command line interface:

mysql -u [用户名] -p

2. Enter the password to log in to MySQL.
3. Run the following command to delete all tables:

DROP DATABASE [数据库名];

Please note that the above command will delete the entire database, including all tables within it. Ensure that you have backed up the database and confirm the deletion operation. If you only want to delete all tables in the database without deleting the entire database, you can follow these steps: 1. Enter the MySQL command-line interface. 2. Enter the following command to select the database containing the tables you want to delete:

USE [数据库名];

Run the following command to delete all tables:

SHOW TABLES;

This command will display all table names in the database. Then, run the following command to delete each table one by one:

DROP TABLE [表名];

Please note that deleting the table will permanently remove the data within it, so make sure you have backed up the data before proceeding with the operation.

广告
Closing in 10 seconds
bannerAds