[mysql]특정DB 전체 테이블 삭제
# DataBase/Mysql(MariaDB)2022. 10. 11. 17:57[mysql]특정DB 전체 테이블 삭제

SET @tables = NULL; SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables FROM information_schema.tables WHERE table_schema = '[DB명]'; SET @tables = CONCAT('DROP TABLE ', @tables); PREPARE stmt FROM @tables; EXECUTE stmt; DEALLOCATE PREPARE stmt; 특정 테이블만 삭제해야할 경우는 조건문에 아래와 같이 추가하면됩니다. AND table_name LIKE '%[테이블명]%'; result SET @tables = NULL > OK > Time: 0.003s SELECT GROUP_CONCAT(tabl..

image