List:General Discussion« Previous MessageNext Message »
From:Thufir Date:April 13 2007 10:44am
Subject: Re: can't import
View as plain text  
I think I got it:


pasty / paste.husk.org

This content is stored as http://paste.husk.org/8089.

From: Someone at 24.84.131.197
Summary: -bash-3.1$ -bash-3.1$ -bash-3.

-bash-3.1$ 
-bash-3.1$ 
-bash-3.1$ whoami
mysql
-bash-3.1$ ls -al /tmp/abc.txt 
-rw-r--r-- 1 mysql mysql 27 Apr 13 11:36 /tmp/abc.txt
-bash-3.1$ cat /tmp/abc.txt 
A1,B1,C1
A2,B2,C2
A3,B3,C3
-bash-3.1$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21 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.09 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.04 sec)

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

mysql> SELECT * FROM delta.abc;
+----+----+----+
| a  | b  | c  |
+----+----+----+
| A1 | B1 | C1 | 
| A2 | B2 | C2 | 
| A3 | B3 | C3 | 
+----+----+----+
3 rows in set (0.03 sec)

mysql> quit
Bye
-bash-3.1$ 
-bash-3.1$ date
Fri Apr 13 11:40:41 BST 2007
-bash-3.1$ 
-bash-3.1$ 
-bash-3.1$ 


Now, would someone please explain *why* this worked and all my other attempts
didn't?  Was it because of file permissions?  or the linux user id?  or that I
put a passwork on the mysql root account? or that I changed the ownership of the
data file?  or that I took out some spaces on the data file?  Or, ... ?


-Thufir

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