MySQL is a commonly used relational database management system. If you need to delete a MySQL table, you may be a little confused. This article will introduce you how to delete a MySQL table.
There are two ways to delete a MySQL table, one is to use the MySQL command line tool, and the other is to use the MySQL Workbench UI tool.
Here, we will introduce these two methods respectively.
Method 1: Use the MySQL command line tool to delete the table
mysql -u [username] -p
Among them, username represents your user name in MySQL. After executing this command, the system will ask you to enter your password.
use [database_name];
where database_name is the name of the database where the table you want to delete is located.
DROP TABLE [table_name];
Among them, table_name is the name of the table you need to delete. After executing this command, MySQL will delete this table from the database.
exit
Now, you have successfully deleted the MySQL table.
Method 2: Use MySQL Workbench UI to delete tables
If you don’t want to use the command line, MySQL Workbench UI provides a more intuitive method.
Now, you have successfully deleted the MySQL table.
Summary
Deleting a MySQL table is very simple whether using the MySQL command line tool or the MySQL Workbench UI. If you no longer need the table, you can easily delete it by following these simple steps in MySQL.
The above is the detailed content of How to delete mysql table. For more information, please follow other related articles on the PHP Chinese website!