MySQL报错ErrorCode:1290.TheMySQLserverisrunningwiththe--secure-file-privoption

问题描述

在MySQL执行如下语句时弹出错误提示:this

use jxgl;
lock tables course read;
select * into outfile 'course.bak' from course;
unlock tables;

错误提示:spa

Error Code: 1290. The MySQL server is running with the --secure-file-priv option  so it cannot execute this statement

根据错误找了相关资料,发现是secure-file-priv会指定文件夹做为导出文件存放的地方,那咱们能够先找出这个文件夹。命令行

在MySQL命令行界面输入一下指令:server

学建站51xuejianzhan.comget

show variables like '%secure%';

咱们能够看到以下结果:it

标注出来的便是正确的文件路径,咱们将导出文件放在该目录下便可。io

对于上述SQL指令,修改以下:table

use jxgl;
lock tables course read;
select * into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/course.bak' from course;
unlock tables;

学建站51xuejianzhan.com这样就能够将数据导出到对应文件夹下,处处成功后能够在对应文件夹下看到导出文件。file

这样就能够解决该问题了:)select

相关文章
相关标签/搜索