The table structure is as follows
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/9E/42/wKioL1mOl66xQ0a1AAA6Sw4G6jw633.png "title=" 1.png "alt=" Wkiol1mol66xq0a1aaa6sw4g6jw633.png "/>
The requirements name and password fields, which generate the following format:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9E/53/wKiom1mOl_2xEMqsAAA5NX-pdNU972.png "title=" 2.png "alt=" Wkiom1mol_2xemqsaaa5nx-pdnu972.png "/>
Generate 500 batches in total.
Solution Ideas:
MySQL stored procedures can be used
If you can use the shell in a Linux environment
Let's first test the first, with the stored procedure.
DELIMITER;; # #定义;; For Terminator create PROCEDURE Test_insert () # #创建存储过程 Test_insert () is the name begin DECLARE y int DEFAULT 1; # #定义y is an integer default starting value is 1WHILE Y<500doinsert into test1 (Name,password,reallyname,age,profession,email,question,result) VALUES (concat (' test ', y), concat (' test ', y), ' Jiang ', ' i ', ' hello ', ' hello ', ' hello ', ' hello '); SET y=y+1; # #y数值加1END while; Commit END;;
Define complete stored procedure Test_insert ()
Execute command call Test_insert () automatically generate 500 data
Problems encountered during the period:
At the beginning,
DECLARE y int DEFAULT 1 incomplete, this command I wrote: DECLARE y TINYINT The default 1 stored procedure is established, the execution of the dead loop, and the insertion of the Y maximum is 127, the reason behind check, found that the TINYINT maximum value of 127 changes into int, the execution succeeds.
This article is from the "Gome Learning" blog, so be sure to keep this source http://goome.blog.51cto.com/4045241/1955738
MySQL BULK insert 500 piece of data