用shell脚本批量插入数据,很简单。直接看代码:
#! /bin/bash host="xxx" port="xxx" userName="xxx" password="xxx" dbname="test" dbset="--default-character-set=utf8 -A" for i in {111..222} do /usr/local/MysqL/bin/MysqL -h${host} -u${userName} -p${password} ${dbname} -P${port} -e "insert into test value($i);" done
实践操作可行,虽然不是手动输入密码会报warning,但是插入数据还是成功。