//创建存储过程

	CREATE DEFINER=`root`@`%` PROCEDURE `batchInsert`(in args int)
	BEGIN
	declare i int default 1;
	start TRANSACTION;
	while i <= args DO
	insert into user(user_name,age,ip) VALUES (concat('temp',i),20,'');
	set i = i+1;
	end while;
	COMMIT;
	end

//调用存储过程

   call batchInsert(1000000);

测试版本:mysql5.7