项目场景: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: