#!/bin/bash
set -x
d=/tmp/city
passwd=123456
mysql -uroot -p${passwd} -e "create database city;"
for n in `cd $d ; ls -l |awk -F "[ .]" 'NR >1,(NF = NF -1) {print $NF}' |uniq `
do
echo $n
dn=${d}/${n}
mysql -uroot -p${passwd} city < /tmp/city/${n}.sql
mysql -uroot -p${passwd} city -e "use city; load data infile \"${dn}.txt\" into table ${n};"
mysql -uroot -p${passwd} city -e "use city;select database(); select \"${dn}.txt\";"
done
阅读(1656) | 评论(0) | 转发(0) |