日期:2014-05-16  浏览次数:20949 次

mysqlimport使用问题?
用mysqlimport工具一直不成功.不知道为什么.

mysqlimport   -uroot   -padmin   -fields-enclosed-by= "   -fields-terminated-by=,   tennis   tz.sql

tennis为我的数据库,里面有tz表.
错误提示是un   known   option   '-e '

然后我又这样写成
mysqlimport   -uroot   -padmin   --fields-enclosed-by= "   --fields-terminated-by=,   tennis   tz.sql.
谁知道就列出了mysqlimport的帮助信息..不知道怎么搞.

------解决方案--------------------
C:\> mysql_init.bat
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.1.17-beta-community-nt-debug MySQL Community Server (GPL)

Type 'help; ' or '\h ' for help. Type '\c ' to clear the buffer.

mysql> use test
Database changed
mysql> select * from temp2;
+--------+--------+--------+--------+--------+--------+--------+
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+--------+--------+--------+--------+--------+--------+--------+
| "1 " | "1 " | "1 " | "2 " | "2 " | "2 " | "3 " |
| "10 " | "15 " | "20 " | "80 " | "100 " | "60 " | "500 " |
| "aaaa " | "bbbb " | "cccc " | "aaaa " | "bbbb " | "dddd " | "dddd " |
| "1 " | "2 " | "3 " | "4 " | "5 " | "6 " | "7 " |
+--------+--------+--------+--------+--------+--------+--------+
4 rows in set (0.00 sec)

mysql> select * from temp2 into outfile 'c:\\temp2.sql ' fields terminated by ', '
lines terminated by '\n ';
Query OK, 4 rows affected (0.00 sec)
mysql> exit
Bye

C:\> mysqlimport -uroot -p******** --fields-terminated-by=, --lines-terminated-b
y=\n test c:\\temp2.sql
test.temp2: Records: 4 Deleted: 0 Skipped: 0 Warnings: 0

C:\> mysql_init.bat
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.1.17-beta-community-nt-debug MySQL Community Server (GPL)

Type 'help; ' or '\h ' for help. Type '\c ' to clear the buffer.

mysql> use test
Database changed
mysql> select * from temp2;
+--------+--------+--------+--------+--------+--------+--------+
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+--------+--------+--------+--------+--------+--------+--------+
| "1 " | "1 " | "1 " | "2 " | "2 " | "2 " | "3 " |
| "10 " | "15 " | "20 " | "80 " | "100 " | "60 " | "500 " |
| "aaaa " | "bbbb " | "cccc " | "aaaa " | "bbbb " | "dddd " | "dddd " |
| "1 " | "2 " | "3 " | "4 " | "5 " | "6 " | "7 " |
| "1 " | "1 " | "1 " | "2 " | "2 " | "2 " | "3 " |
| "10 " | "15 " | "20 " | "80 " | "100 " | "60 " | "500 " |
| "aaaa " | "bbb