应该指定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中全文检索在实现的时候出错,请各位帮忙,在线等待
- 如何让一个非空字段插入null的时候,提示错误,不让其插入。
- 新人弱问:connector C++ 和 MYSQL++ API有啥区别?
- mysql初始化库失败
- Mysql数据库触发器的问题。
- UPDATE FROM 这个语句怎么写?
- 建表时 多表好 还是 复用表好?
- 有空就开始研究一下POSTGRESQL,发现POSTGRESQL的问题大家都不太知道。大家顶起来啊
- 快来抢购印有MySQL、PostgreSQL、Java、Linux的Logo的文件衫!
- MySql Workbench中显示中文乱码
- 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.