MYSQLDUMPにてデータのみをテキストファイルに抽出する。

[root@colinux tmp]# mysqldump --no-create-info --tab=/tmp --lines-terminated-by=
"\r\n" TEST -u root -p

Enter password:
[root@colinux tmp]# ls -l

[root@colinux tmp]# ls -l
total 8
srwxrwxrwx 1 mysql mysql 0 2009-02-06 18:09 mysql.sock
-rw-rw-rw- 1 mysql mysql 320 2009-02-06 18:11 T1.txt
-rw-rw-rw- 1 mysql mysql 15 2009-02-06 18:11 T2.txt
[root@colinux tmp]#

data_only

mysql> LOAD DATA INFILE ‘/tmp/T1.txt’ INTO TABLE T1 LINES TERMINATED BY ‘\r\n’;
Query OK, 12 rows affected (0.02 sec)
Records: 12 Deleted: 0 Skipped: 0 Warnings: 0

mysql> select * from T1;
+—-+————+—————+
| id | name | comment |
+—-+————+—————+
| 1 | SHOW WARIN | test update |
| 2 | SHOW WARIN | 22222222222 |
| 3 | select_lim | test 20090117 |
| 4 | select_lim | test 20090117 |
| 5 | select_lim | test 20090117 |
| 6 | select_lim | test 20090117 |
| 7 | select_lim | test 20090117 |
| 8 | select_lim | test 20090117 |
| 9 | select_lim | test 20090117 |
| 10 | FLUSHMAN | TEST DE SU |
| 11 | FLUSHMAN | TEST DE SU |
| 12 | FLUSHMAN | TEST DE SU |
+—-+————+—————+
12 rows in set (0.00 sec)

mysql>

load

Comments are closed.

Post Navigation