错误2068(HY000):由于访问限制,加载数据本地INFILE文件请求被拒绝

2022-03-04 00:00:00 load mysql

评论我正在尝试,

mysql> 

LOAD DATA LOCAL INFILE '/var/tmp/countries.csv' 
INTO TABLE countries 
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"' LINES 
TERMINATED BY '
' 
IGNORE 1 LINES 
(CountryId,CountryCode,CountryDescription,CountryRegion,LastUpdatedDate,created_by,created_on)
SET created_by = 'DH_INITIAL_LOAD', created_on = current_timestamp();

错误2068(HY000):由于访问限制,LOAD DATA LOCAL INFILE FILE请求被拒绝。`

运行正常,我下载了python脚本的pymysql和MySQL连接器。我卸载并检查了它仍然不能工作。 Verion和infile处于打开状态,

 select version() -| 8.0.17



mysql> SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile  | ON    |
+---------------+-------+
1 row in set (0.00 sec)

解决方案

已知问题:https://bugs.mysql.com/bug.php?id=91872

要解决尝试连接到MySQL本身时的解决方法,请将local-infile设置为1,然后执行LOAD命令: MySQL--local-infile=1-h$MASTER_DB_HOST-u$MASTER_DB_USER-p$MASTER_DB_PASSWD-D$MASTER_DB_NAME

相关文章