Home > Database > Mysql Tutorial > body text

How to delete all tables in mysql database

王林
Release: 2020-10-14 16:15:33
Original
8024 people have browsed it

Mysql method to delete all tables in the database: directly execute the [SELECT table_name FROM information_schema.tables WHERE table_schema = 'mydb';] statement to delete.

How to delete all tables in mysql database

Just execute the following SQL statement directly on the command line:

(Recommended tutorial: mysql video tutorial)

SELECT concat('DROP TABLE IF EXISTS ', table_name, ';')
FROM information_schema.tables
WHERE table_schema = 'mydb';
Copy after login

Explanation: mydb represents the database name of the table to be deleted.

Related recommendations: mysql tutorial

The above is the detailed content of How to delete all tables in mysql database. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!