MySQL批量插入数据脚本
MySQL批量插入数据脚本
#!/bin/bash
i=1;
MAX_INSERT_ROW_COUNT=$1;
while[$i-le$MAX_INSERT_ROW_COUNT]
do
mysql-uroot-prootdbname-e"insertintotablename(name,age,createTime)values('HELLO$i',$i%99,NOW());"
d=$(date+%M-%d\%H\:%m\:%S)
echo"INSERTHELLO$i@@$d"
i=$(($i+1))
sleep0.05
done
exit0
新建表格就可以了
createtableafs_test( namevarchar()32, ageint(32), createTimedatetime
插入十万的数据为./jiaoben.sh100000