MySQL Loading local data is disabled; this must be enabled on both the client and server sides

项目场景:MySQL

`提示:MySQL导入大量数据,报错Loading local data is disabled; this must be enabled on both the client and server sides

问题描述

MySQL导入大量数据,总是报错Loading local data is disabled; this must be enabled on both the client and server sides
但是设置过
导入数据语句:load data local infile 'C:/file/tb_sku2.sql’into table tb_sku fields terminated by ‘,’ lines terminated by ‘\n’;
select @@local_infile;
set GLOBAL local_infile =1;
SHOW GLOBAL VARIABLES LIKE ‘local_infile’;
继续报错:LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.
然后发现在登陆时设置:
mysql -u root -p --local-infile
Enter password:
再加载数据,数据成功加载


解决方案:

提示:这里填写该问题的具体解决方案:
在sql中设置:
– 查询local_infile 状态
select @@local_infile;
设置local_infile状态
set GLOBAL local_infile =1;
–显示当前local——infile状态
SHOW GLOBAL VARIABLES LIKE ‘local_infile’;
–先设置上述状态为1,若继续报错:LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.
则使用以下语句重新登录MySQL:
mysql -u root -p --local-infile
Enter password:

  • 10
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值