gaohongyu

新建表

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

分类:

技术点:

相关文章:

  • 2021-11-13
  • 2021-11-03
  • 2021-11-13
  • 2021-04-30
猜你喜欢
  • 2021-06-13
  • 2021-04-06
  • 2022-12-23
  • 2021-06-23
  • 2021-06-06
  • 2022-03-06
相关资源
相似解决方案