解决MySQL导入导出时报错

解决MySQL导入导出时报错:

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

首先 查看secure-file-priv

show variables like ‘%secure%’

解决MySQL导入导出时报错_第1张图片

这里显示了上传文件的路径必须是存于:

C:\ProgramData\MySQL\MySQL Server 5.7\Uploads\

文件夹下面

解决方法最好是:
将上传文件存于C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/下面
执行语句相应的修改为:

load data infile ‘C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/inportfilename.txt’ into table tablename fields terminated by’,’ lines terminated by’\r\n’;

这里需要非常注意的地方:

文件路径用”/ ”
即 C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/inportfilename.txt

而不是
C:\ProgramData\MySQL\MySQL Server 5.7\Uploads\inportfilename.txt

你可能感兴趣的:(Mysql)