DB & SQL
mysql 모든 table 삭제
puttico
2015. 6. 23. 00:58
-- MySQL drop all tables in database SET @tables = NULL; SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables FROM information_schema.tables WHERE table_schema = 'database_name'; -- specify DB name here. SET @tables = CONCAT('DROP TABLE ', @tables); PREPARE stmt FROM @tables; EXECUTE stmt; DEALLOCATE PREPARE stmt;
5번 라인의 'database name'에 모든 테이블을 삭제할 database 이름을 넣어줌