#mysql -uroot -p123456

create database gblfy;
use gblfy
create table test(name varchar(10),age int,height int);


//创建过程
use gblfy
drop procedure if exists test1;
DELIMITER $$
CREATE PROCEDURE test1()
begin
DECLARE i int DEFAULT 1;
WHILE i<1000000 DO
insert INTO test (name,age,height) VALUES(CONCAT('name',i),i,i);
set i=i+1;
end WHILE;
commit;
end;
$$
DELIMITER ;


//调用存储过程
call test1();
select count(*) from xydb1.test;


mysql> select * from xydb1.test limit 14;
+--------+------+--------+
| name | age | height |
+--------+------+--------+
| name1 | 1 | 1 |
| name2 | 2 | 2 |
| name3 | 3 | 3 |
| name4 | 4 | 4 |
| name5 | 5 | 5 |
| name6 | 6 | 6 |
| name7 | 7 | 7 |
| name8 | 8 | 8 |
| name9 | 9 | 9 |
| name10 | 10 | 10 |
| name11 | 11 | 11 |
| name12 | 12 | 12 |
| name13 | 13 | 13 |
| name14 | 14 | 14 |
+--------+------+--------+
14 rows in set (0.00 sec)