应该指定pet.txt的绝对路径
这是我的操作,正确!
mysql> LOAD DATA INFILE "d:/abc/pet.txt" INTO TABLE aa;
Query OK, 9 rows affected (0.02 sec)
Records: 9 Deleted: 0 Skipped: 0 Warnings: 54
这是我的操作,正确!
mysql> LOAD DATA INFILE "d:/abc/pet.txt" INTO TABLE aa;
Query OK, 9 rows affected (0.02 sec)
Records: 9 Deleted: 0 Skipped: 0 Warnings: 54
解决方案 »
- 求MYSQL查询语句的一个合并查询结果语法
- windows下mysql会导致pf使用率偏高么?
- 急求:CAST(0x0000A09C012CA92A AS DateTime) 转换为MYSQL用的INT或者varchar
- java mysql insert中文正常,select 条件中文乱码
- myslq的 expt 是否可以做
- 此sql如何添加索引 效率最高?
- 急问:有什么文档可以查找mySql的错误号代表什么?(例如1064等等具体代表什么)
- 一点不小气,百分求一句SQL写法,在线等,ok马上结
- 帮忙看看这个表应该怎么设计
- MySQL如何访问SQL Server数据库
- mysql中怎样实现ID的自动增值
- 如何将oracle数据库中的表转换(导入)mysql数据库??请指点!
主要是你用了LOCAL 关键字
If the LOCAL keyword is not present, MySQL looks for the datafile on the server host.
我將pet.txt 放到C:\mysql\data\menagerie
shell>LOAD DATA INFILE 'pet.txt'INTO TABLE pet ;或者
shell>LOAD DATA INFILE 'menagerie/pet.txt'INTO TABLE pet ok,無問題.If the LOCAL keyword is specified, MySQL looks for the file on the client host, and interprets the pathname the same way your command interpreter does將pet.txt 放到d:\pet
mysql> LOAD DATA LOCAL 'd:/pet/pet.txt' INTO table pet ;ERROR 1148: The used command is not allowed with this MySQL versionmysql>LOAD DATA 'd:/pet/pet.txt' INTO table pet
Query OK.可能这个原因?
As of MySQL 3.23.49, use of the LOCAL keyword may be disabled by default. You may be able to turn it on using the --local-infile option for mysql. If that doesn't work, your server has been configured not to allow LOAD DATA LOCAL at all.
于时执行msyql>--local-infile
再试,mysql> LOAD DATA LOCAL 'd:/pet/pet.txt' INTO table pet
还是出现error1148:
算了.准备结贴!!!
不得不说,mysql文档自带教程却一笔带过,只字不提local,靠,让人不知所谓,百思不得其解.
To load the text file `pet.txt' into the pet table, use this command:
mysql> LOAD DATA LOCAL INFILE "pet.txt" INTO TABLE pet;You can specify the column value separator and end of line er explicitly in the LOAD DATA statement if you wish, but the defaults are tab and linefeed. These are sufficient for the statement to read the file `pet.txt' properly.