mysqlimport [-d/-f...] db_name data.txt
mysqlimport -uroot -pgroad -hlocalhost books data_import.txt
mysql> use bookstore;
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_bookstore |
+---------------------+
| authors |
| books |
+---------------------+
2 rows in set (0.00 sec)
mysql> desc authors;
[attach]373[/attach]
$ cat authors.txt
4 Lee Tony China
5 Wong Jimy USA
6 Chou Lily JAPAN
7 Gou Ben UK
# cp authors.txt /var/lib/mysql/bookstore/
$ mysqlimport -uroot -p123456 -hlocalhost bookstore authors.txt
mysqlimport: Error: 13, Can't get stat of '/var/lib/mysql/bookstore/authors.txt' (Errcode: 2), when using table: authors
# mysqlimport -uroot -p123456 -hlocalhost bookstore authors.txt
bookstore.authors: Records: 4 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from authors;
[attach]372[/attach]
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |