- 批量插入数据
需要传入一个参数,这里没有使用密码登陆,使用密码使用“-ppassword”
#!/bin/bash
i=1;
MAX_INSERT_ROW_COUNT=$1;
while [ $i -le $MAX_INSERT_ROW_COUNT ]
do
mysql -hlocalhost -uroot -e"insert into test.testCreate values ($i,'dd','dd');"
d=$(date +%M-%d\ %H\:%m\:%S)
echo "INSERT HELLO $i @@ $d"
i=$(($i+1))
sleep 0.05
done
exit 0
运行./insert.sh 10 插入10行数据成功
执行sql