Server/Django issue

[Django] MySQL 테이블 전체 삭제

개발자킹콩 2022. 8. 5. 16:24
$ mysql -uroot -p

mysql>

SET @tables = NULL;
 SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables
   FROM information_schema.tables 
   WHERE table_schema = 'DB명'; -- specify DB name here.
 SET @tables = CONCAT('DROP TABLE ', @tables);
 PREPARE stmt FROM @tables;
 EXECUTE stmt;
 DEALLOCATE PREPARE stmt;

 


Reference

https://bizmark.co.kr/setup-and-tips/mysql/mysql-테이블만-전체-삭제-하는법/

 

Mysql 테이블만 전체 삭제 하는법 - IT infomation

myslq 에서 접속을 하고 난 후 실행 하시면 됩니다.

bizmark.co.kr