正确写法是这样的:
load data local infile 'D:\1.sql' into table tests columns terminated by ' ' lines terminated by '\r\n'
如果上面一句还是报找不到文件
那就改成下面这样的吧
load data local infile 'D:/1.sql' into table tests columns terminated by ' ' lines terminated by '\r\n'
还要写列分隔符及行分隔符
有图:
刚才试了下通过SQL_MODE来控制,发现还是不行。跟文档上描述的有出入,不知道是不是版本问题mysql>select
@@session.sql_mode+----------------------------------------------------------------+|
@@session.sql_mode
|+----------------------------------------------------------------+|
STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
|
+----------------------------------------------------------------+1
row
in
set
(0.00
sec)mysql>
load
data
local
infile
'/home/wanghai01/data/customer_20111022.dat'
into
table
aa
fields
terminated
by','
lines
terminated
by'\n'Query
OK,
3
rows
affected,
2
warnings
(0.01
sec)Records:
3
Deleted:
0
Skipped:
0
Warnings:
1mysql>
mysql>
select
version()+------------+|
version()
|+------------+|
5.1.45-log
|
+------------+1
row
in
set
(0.01
sec)
对我有用[0]丢个板砖[0]引用举报管理TOPwh62592855(右鞋左穿)等
级:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)