#!/usr/bin/bash
#dData=`dirname $0`/data
dData=/tmp/data
mkdir -p $dData && cd $dData
mysqldump -uroot test > $dData/test.sql
mysqldump -uroot test t > $dData/test.t.sql
#mysql -uroot < $dData/test.sql
#mysql -uroot < $dData/test.t.sql
exit
exit
exit
--routines
--triggers
#!/usr/bin/bash
#dData=`dirname $0`/data
dData=/tmp/data
mkdir -p $dData
cd $dData
mysql -uroot <<EOF
use test;
truncate table t;
select * from t;
EOF
mysqlimport --fields-terminated-by=, --fields-enclosed-by='"' \
--lines-terminated-by="\n", --ignore \
test $dData/t.txt
## '--ignore/--replace' contain unique key values already in the table, 'test' is database name, 't' is the tablename.
Wish this helps. regards, Stanley Huang
Comments
Post a Comment