使用方法:
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[FIELDS
[TERMINATED BY '\t']
[[OPTIONALLY] ENCLOSED BY ']
[ESCAPED BY '\\' ]
]
[LINES
[STARTING BY ']
[TERMINATED BY '\n']
]
[IGNORE number LINES]
[(col_name,...)]
但是由于安全的问题,这个命令在缺省的情况下时候无法运行的,相关说明如下:
As of MySQL 3.23.49 and MySQL 4.0.2 (4.0.13 on Windows), LOCAL will work only if your server and your client both have been enabled to allow it. For example, if mysqld was started with --local-infile=0, LOCAL will not work.
解决的办法是:
在Linux里运行mysql -u -p --local-infile=1
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[FIELDS
[TERMINATED BY '\t']
[[OPTIONALLY] ENCLOSED BY ']
[ESCAPED BY '\\' ]
]
[LINES
[STARTING BY ']
[TERMINATED BY '\n']
]
[IGNORE number LINES]
[(col_name,...)]
但是由于安全的问题,这个命令在缺省的情况下时候无法运行的,相关说明如下:
As of MySQL 3.23.49 and MySQL 4.0.2 (4.0.13 on Windows), LOCAL will work only if your server and your client both have been enabled to allow it. For example, if mysqld was started with --local-infile=0, LOCAL will not work.
解决的办法是:
在Linux里运行mysql -u -p --local-infile=1

浙公网安备 33010602011771号