MySQL批量插入数据脚本
程序员文章站
2024-02-21 10:45:46
mysql批量插入数据脚本
#!/bin/bash
i=1;
max_insert_row_count=$1;
while [ $i -le $max_in...
mysql批量插入数据脚本
#!/bin/bash i=1; max_insert_row_count=$1; while [ $i -le $max_insert_row_count ] do mysql -uroot -proot dbname -e "insert into tablename (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
新建表格就可以了
create table afs_test( name varchar()32, age int(32), createtime datetime
插入十万的数据为./jiaoben.sh 100000