List:General Discussion« Previous MessageNext Message »
From:Mogens Melander Date:April 13 2007 10:01am
Subject:Re: can't import
View as plain text  
Hmmm, i got a somewhat different result :^)

(BTW. I'm on Slackware 10.0. What are you on?)

$ cat /tmp/abc.txt
A1, B1, C1
A2, B2, C2
A3, B3, C3

$mysql test
Server version: 5.0.24a-log

mysql> SHOW GRANTS FOR ''@localhost;
+--------------------------------------+
| Grants for @localhost                |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
1 row in set (0.00 sec)

mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| abc            |
+----------------+
1 row in set (0.00 sec)

mysql> describe abc;
+-------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+-------+
| a     | text | NO   |     |         |       |
| b     | text | NO   |     |         |       |
| c     | text | NO   |     |         |       |
+-------+------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> LOAD DATA INFILE '/tmp/abc.txt' INTO TABLE test.abc
    -> FIELDS TERMINATED BY ','
    -> LINES TERMINATED BY '\n';
Query OK, 3 rows affected (0.02 sec)
Records: 3  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from abc;
+----+-----+-----+
| a  | b   | c   |
+----+-----+-----+
| A1 |  B1 |  C1 |
| A2 |  B2 |  C2 |
| A3 |  B3 |  C3 |
+----+-----+-----+
3 rows in set (0.00 sec)

-- 
Later

Mogens Melander
+45 40 85 71 38
+66 870 133 224


On Fri, April 13, 2007 09:39, Thufir wrote:
> Mogens Melander <mogens <at> fumlersoft.dk> writes:
>
>>
>> Hmmm, your "LINES TERMINATED BY '/r/n';"
>>
>> should be:
>>
>> "LINES TERMINATED BY '\r\n';"
>>
>> if the abc.txt file was generated on windows. If it
>> was made on *nix/linux, it should be:
>>
>> LINES TERMINATED BY '\n';
>
> I think I fixed it, at least as best I could.  still same result:
>
> [thufir@localhost ~]$
> [thufir@localhost ~]$
> [thufir@localhost ~]$ su - mysql
> Password:
> -bash-3.1$
> -bash-3.1$ mysql -u root -p
> Enter password:
> Welcome to the MySQL monitor.  Commands end with ; or \g.
> Your MySQL connection id is 18 to server version: 5.0.27
>
> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>
> mysql> SHOW DATABASES;
> +--------------------+
> | Database           |
> +--------------------+
> | information_schema |
> | alpha              |
> | bravo              |
> | charlie            |
> | delta              |
> | mysql              |
> | test               |
> +--------------------+
> 7 rows in set (0.40 sec)
>
> mysql> USE delta;
> Reading table information for completion of table and column names
> You can turn off this feature to get a quicker startup with -A
>
> Database changed
> mysql> SHOW TABLES;
> +-----------------+
> | Tables_in_delta |
> +-----------------+
> | abc             |
> +-----------------+
> 1 row in set (0.00 sec)
>
> mysql> DESCRIBE abc;
> +-------+------+------+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +-------+------+------+-----+---------+-------+
> | a     | text | NO   |     |         |       |
> | b     | text | NO   |     |         |       |
> | c     | text | NO   |     |         |       |
> +-------+------+------+-----+---------+-------+
> 3 rows in set (0.37 sec)
>
> mysql> LOAD DATA INFILE '/tmp/abc.txt' INTO TABLE delta.abc FIELDS
> TERMINATED BY
> ',' LINES TERMINATED BY '\n';
> ERROR 13 (HY000): Can't get stat of '/tmp/abc.txt' (Errcode: 13)
> mysql> ;
> ERROR:
> No query specified
>
> mysql> quit
> Bye
> -bash-3.1$ exit
> logout
> [thufir@localhost ~]$
> [thufir@localhost ~]$ cat /tmp/abc.txt -n
>      1  A1, B1, C1
>      2  A2, B2, C2
>      3  A3, B3, C3
> [thufir@localhost ~]$
> [thufir@localhost ~]$ cat /tmp/abc.txt
> A1, B1, C1
> A2, B2, C2
> A3, B3, C3
> [thufir@localhost ~]$
> [thufir@localhost ~]$
> [thufir@localhost ~]$
> [thufir@localhost ~]$ ll /tmp/abc.txt
> -rw-r--r-- 1 thufir thufir 33 Apr 12 06:59 /tmp/abc.txt
> [thufir@localhost ~]$
> [thufir@localhost ~]$
> [thufir@localhost ~]$ date
> Fri Apr 13 08:33:44 BST 2007
> [thufir@localhost ~]$
> [thufir@localhost ~]$
> [thufir@localhost ~]$
>
>
>
> thanks,
>
> Thufir
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>
> --
> This message has been scanned for viruses and
> dangerous content by OpenProtect(http://www.openprotect.com), and is
> believed to be clean.
>



-- 
This message has been scanned for viruses and
dangerous content by OpenProtect(http://www.openprotect.com), and is
believed to be clean.

Thread
can't importThufir12 Apr
  • Re: can't importChris12 Apr
  • Re: can't importMogens Melander12 Apr
  • Re: can't importThufir13 Apr
    • Re: can't importChris13 Apr
    • Re: can't importMogens Melander13 Apr
  • Re: can't importThufir13 Apr
    • Re: can't importChris16 Apr
  • Re: can't importThufir23 Feb