Schema.pro

MySQL delete all tables

04.10 2018|MySQL

Delete all tables from MySql database

To delete all tables from MYSQL database execute the following commands in MYSQL command line:

SET FOREIGN_KEY_CHECKS = 0;
SET @tables = NULL;
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables
FROM information_schema.tables
WHERE table_schema = 'database_name'; -- write database name here

SET @tables = CONCAT('DROP TABLE ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET FOREIGN_KEY_CHECKS = 1;


Simple delete all tables from MySQL database
Programming, coding, system administration linux

 1 
  Comment
YouTube video
Add image
OK