(1)创建测试表
create table test01 ( id1 int not null auto_increment,name varchar(30),primary key(id1) ); test02 ( id2 (id2) );
(2)创建存储过程
CREATE DEFINER=`root`@`%` PROCEDURE `p_insert`() BEGIN #Routine body goes here... DECLARE str1 ); DECLARE str2 DECLARE i int; set i = 0; while i < 10000 do set str1 = substring(md5(rand()),1,1); font-weight: bold">25insert into test01(name) values(str1); set str2 into test02(name) (str2); = i + 1end whileEND
(3)制定定时事件
use lijiamandb; create event if not exists e_insert on schedule every 10 second on completion preserve do call p_insert();
(4)手动开始event
MysqL> show variables like '%event_scheduler%'; +----------------------------------------------------------+-------+ | Variable_name | Value | | event_scheduler | OFF --------------------------------------------------------+-------+ MysqL> set global event_scheduler = ; Query OK,0 rows affected (0.08 sec)
其它测试数据:
https://github.com/datacharmer/test_db
相关文档集合: 1.MysqL数据库创建随机测试数据 |