#创建生成测试数据的存储过程 DROP PROCEDURE IF EXISTS test; CREATE PROCEDURE test() BEGIN DECLARE i INT DEFAULT 0; SET autocommit = 0; WHILE i<100000 DO INSERT INTO `test`.`user` (`uid`, `task_id`, `publisher_id`, `expired_at`, `update_at`) VALUES ( 450+i, '125', '1', '2','2017-09-08 14:42:23', '2017-09-08 13:42:30'); SET i = i+1; IF i%1000 = 0 THEN COMMIT; END IF; END WHILE; END; #执行存储过程生成测试数据 CALL test();