Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- Effective Java 3/e
- 정규표현식
- eslint
- 퀵소트
- spring
- Regular expression
- log_bin
- Node
- update
- REACT
- expire_logs_days
- java
- Spring Batch
- spring cloud
- current_date
- Chunk
- Effective Java
- Express
- git
- log4j2
- REACTJS
- migration
- mysql 5.5
- npm
- nodejs
- Webpack
- regex
- upgrade
- MySQL
- JavaScript
Archives
- Today
- Total
내 세상
[MySQL] 테이블 전체 삭제 본문
728x90
MySQL 로그인 후, DB connection 하기 전에 진행해야 함.
1. SET @tables = NULL;2. SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables FROM information_shcema.tables WHERE table_schema = 'DB_NAME';-- DB_NAME : 실제 DB 명 입력3. SET @tables = CONCAT('DROP TABLE ', @tables);4. PREPARE stmt FROM @tables;5. SET foreign_key_checks = 0; -- foreign key 묶여서 삭제 안될 때 option5. EXECUTE stmt;6. DEALLOCATE PREPARE stmt;7. SET foreign_key_checks = 1; -- foreign key 관련 속성 원래대로 초기화
728x90
'Technical > MySQL' 카테고리의 다른 글
[MySQL] CPU / Memory / InnoDB Buffer Usage 100% 이슈 조치 (0) | 2021.04.16 |
---|---|
[MySQL] ON DUPLICATE KEY UPDATE 사용 (값이 중복되면 UPDATE, 아니면 INSERT) (0) | 2021.02.08 |
[MySQL] Error: ER_TRUNCATED_WRONG_VALUE: Truncated incorrect DOUBLE value (0) | 2020.06.16 |
[MySQL] Error: ER_CON_COUNT_ERROR: Too many connections (0) | 2020.05.27 |
[MySQL] MariaDB, MySQL 삭제 (0) | 2019.07.30 |