用mysqlimport工具一直不成功.不知道为什么.mysqlimport -uroot -padmin -fields-enclosed-by=" -fields-terminated-by=, tennis tz.sqltennis为我的数据库,里面有tz表.
错误提示是un known option '-e'然后我又这样写成
mysqlimport -uroot -padmin --fields-enclosed-by=" --fields-terminated-by=, tennis tz.sql.
谁知道就列出了mysqlimport的帮助信息..不知道怎么搞.

解决方案 »

  1.   

    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
    ByeC:\>mysqlimport -uroot -p******** --fields-terminated-by=, --lines-terminated-b
    y=\n test c:\\temp2.sql
    test.temp2: Records: 4  Deleted: 0  Skipped: 0  Warnings: 0C:\>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" | "bbbb" | "cccc" | "aaaa" | "bbbb" | "dddd" | "dddd" |
    | "1"    | "2"    | "3"    | "4"    | "5"    | "6"    | "7"    |
    +--------+--------+--------+--------+--------+--------+--------+
    8 rows in set (0.00 sec)mysql>
      

  2.   

    你得确定你的tz.sql格式正确。
      

  3.   

    是啊..格式应该没问题吧.
    我是用
    select * into outfile 'd:\\tz.sql'
    fields
    terminated by ','
    enclosed by '"'
    from table
    这样生成的一个tz.sql文件.而用mysqlimport就导不进去.
      

  4.   

    那你就用这样个语句:
    C:\>mysqlimport -u你的用户名(必须具有FILE权限) -p密码 --fields-terminated-by=, --lines-terminated-b
    y=\n test c:\\temp2.sql我写了篇文章,你看看
    http://blog.chinaunix.net/u/29134/showart_370194.html