MySQL使用LOAD DATA LOCAL INFILE报错

在windows系统的MySQL8.0中尝试执行如下语句时报错mysql

mysql> LOAD DATA LOCAL INFILE '/path/filename' INTO TABLE tablename;sql

 

ERROR 1148 (42000): The used command is not allowed with this MySQL versionwindows

所用的指令在当前MySQL版本不被容许,this

但其实MySQL5.1及以上都支持此命令,报这个错是由于MySQL中系统变量local-infile=0时不容许本地加载数据,在安装目录找到配置文件my.ini,修改其中的local-infile=1,或在启动MySQL时添加--local-infile选项code

mysql -uroot --local-infile=1 -pserver

password:******input

 

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statementit

MySQL服务正在以--secure-file-priv选项运行,所以没法执行这个语句,io

出错的缘由是由于在MySQL 5.7.6版本以后,导入文件只能在secure_file_priv指定的文件夹下(也有缘由是由于权限不够),咱们能够用show variables like '%secure%';命令显示文件目录,把须要导入的文件放在secure-file-priv参数指定的文件夹下,以后再从这里导入就能够了table

 

ERROR 2 (HY000): File not found (OS errno 2 - No such file or directory)

文件未找到,

在windows系统下提供文件路径时须要将全部"\变为“\\”,如C:\\Program Files\\MySQL\\MySQL Server 8.0\\file

相关文章
相关标签/搜索