MySQL造数据,批量插入数据脚本
新建表
create table bigdata( name varchar(32), age int(32), createTime datetime);
MySQL批量插入数据脚本
#!/bin/bash
i=1;
MAX_INSERT_ROW_COUNT=$1;
while [[ $i -le $MAX_INSERT_ROW_COUNT ]];do
mysql -uadmin -pKingsoft123@@ -P40006 -h10.11.0.55 bigdata -e "insert into bigdata (name,age,createTime) values ('HELLO$i',$i % 99,NOW());"
d=$(date +%M-%d\ %H\:%m\:%S)
echo "INSERT HELLO $i @@ $d"
i=$(($i+1))
sleep 0.05
done
exit 0
插入十万的数据为./jiaoben.sh 100000
QQ:1061767621
Q群:215481318