USE squidconf; DROP TABLE IF EXISTS totalBlockTmp; CREATE TABLE `totalBlockTmp` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `dstdom` varchar(255) NOT NULL, `y` int(11) NOT NULL DEFAULT 1, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `comment` text DEFAULT NULL, PRIMARY KEY (`id`), KEY `totalBlock_dstdom_IDX` (`dstdom`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; LOAD DATA LOCAL INFILE '###FILENAME###' INTO TABLE totalBlockTmp FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@col1) set dstdom=@col1; SET autocommit=0; START TRANSACTION; ALTER TABLE totalBlock RENAME totalBlockOld; ALTER TABLE totalBlockTmp RENAME totalBlock; DROP TABLE totalBlockOld; COMMIT; SET autocommit=1;