MySQL 中本地数据上传
MySQL 中本地数据上传一般可以用 LOAD DATA LOCAL INFILE 命令. 但是 MySQL8 中设置了安全上传目录.
在登录时可以加上选项 --local-infile=1
即
mysql.exe -uroot -p --local-infile=1
否则使用 load data local infile 'D:\\tmp\\sample.sql' 时会产生错误:
ERROR 2068 (HY000): LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.
检查变量 local_infile
mysql> show variables like '%local_infile%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | ON |
+---------------+-------+
1 row in set, 1 warning (0.00 sec)