SET @tables = NULL;
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables
  FROM information_schema.tables
  WHERE table_schema = 'capstone'; -- specify DB name here.

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

'Database' 카테고리의 다른 글

mysql 1406 / Data too long for column '' at row  (0) 2020.11.12
  1. mysql -u root -p 로 mysql shell 접속
  2. select @@global.sql_mode; 로 모드에 STRICT_TRANS_TABLES 가 포함된 것 확인
    • STRICT_TRANS_TABLES : 데이터 타입이 틀린 데이터를 추가하거나, 범위를 벗어날 때 오류 발생. 하지만 비활성화하여 해야하는 경우가 더러 있다.
  3. set @@global.sql_mode = "ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" 으로 해당 모드 비활성화
  4. 여전히 안된다면 SET GLOBAL max_allowed_packet = 1024 * 1024 * 32; 을 통해 패킷 수신 최대 크기 한계 조정

'Database' 카테고리의 다른 글

mysql 테이블 전체 삭제  (0) 2020.11.30

+ Recent posts