我尝试“ mysql 8.0”本地文件失败,并显示设置。可能是权限问题?

以下是我的会话,我的数据位于mysql所有者/组的目录中
    mysql -u root -p     输入密码:     欢迎使用MySQL监视器。命令以;结尾;或\ g。     您的MySQL连接ID为8     服务器版本:8.0.18 MySQL Community Server-GPL

Copyright (c) 2000,2019,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set global local_infile = 1;
Query OK,0 rows affected (0.00 sec)

mysql> use SSC;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> load data local infile '/storage/temp/myest1.csv' into table SSC fields terminated by ',' lines terminated by '\n' ignore 1 lines;
ERROR 1148 (42000): The used command is not allowed with this MySQL version
mysql> show variables like "local_infile";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile  | ON    |
+---------------+-------+
1 row in set (0.00 sec)

mysql> load data local infile '/storage/temp/myest1.csv' into table SSC;
ERROR 1148 (42000): The used command is not allowed with this MySQL version
mysql> load data local infile 'myest1.csv' into table SSC;
ERROR 1148 (42000): The used command is not allowed with this MySQL version
mysql> SELECT @@global.secure_file_priv;
+---------------------------+
| @@global.secure_file_priv |
+---------------------------+
| /storage/temp/            |
+---------------------------+
1 row in set (0.00 sec)
OK852531755 回答:我尝试“ mysql 8.0”本地文件失败,并显示设置。可能是权限问题?

如果将LOCAL选项与LOAD DATA INFILE一起使用,则secure_file_priv不会用于加载文件的位置。该文件由客户端加载,因此您使用的路径不在服务器上,而是在客户端上。如果提供相对路径,则它是相对于启动客户端时相对于当前工作目录的。

但是,服务器和客户端都必须启用--local-infile选项。

您已经在服务器中设置了该选项,但是您还需要像这样在客户端中对其进行设置:

mysql --local-infile -u root -p

我认为您收到的错误消息是毫无帮助的。我记录了一个有关它的错误:

Bug #94396 Error message too broad: The used command is not allowed with this MySQL version

如果您同意,请对该错误报告进行投票!

本文链接:https://www.f2er.com/3163887.html

大家都在问