mysql使用shell脚本直接插入数据到指定库
写了一个脚本deptimport.sh
#!/bin/sh if [ $# -eq 2 ] ; then `mysql -uroot -p123456 -D$1 < $2`; exit; fi
使用方式shdeptimport.sheseal_ms_jsq/tmp/caojingzhen_jinshanweizhen_dept.sql
eseal_ms_jsq为mysql数据库其中一个库名。
caojingzhen_jinshanweizhen_dept.sql中是罗列的sql语句,如下:
insertintoTABLE_NAME(col1,col2,col3,col4)values('value1',0,'value1','value1');
insertintoTABLE_NAME(col1,col2,col3,col4)values('value2',0,'value2','value2');
相关推荐
laisean 2020-11-11
zhangjie 2020-11-11
大牛牛 2020-10-30
firefaith 2020-10-30
liguojia 2020-10-20
wangzhaotongalex 2020-10-20
CARBON 2020-10-20
JohnYork 2020-10-16
xiaonamylove 2020-10-16
Julyth 2020-10-16