【发布时间】:2020-03-02 23:28:50
【问题描述】:
我在 Ubuntu 1804 上使用 Maria DB:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
我想做一些相对简单的事情,我已经浪费了 2 个小时。我想将文件加载为字符串。这个网站上有几个问题(其中很多问题很老),但没有一个能引导我找到解决方案,我已经测试了所有问题,直到完全失望。
授予权限:
MariaDB [(none)]> GRANT FILE ON *.* TO matias@localhost;;
Query OK, 0 rows affected (0.00 sec)
ERROR: No query specified
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> SHOW GRANTS FOR matias@localhost
-> ;
+------------------------------------------------------------------------------------------------------------------------+
| Grants for matias@localhost |
+------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'matias'@'localhost' IDENTIFIED BY PASSWORD '*???' |
+------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
没有secure_file_priv:
MariaDB [(none)]> SHOW VARIABLES LIKE 'secure_file_priv';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
1 row in set (0.00 sec)
文件的正确权限:
[~]@Ubuntu1804 #> ls -lh test.txt
-rw-rw-r-- 1 matias matias 6 Feb 29 23:44 test.txt
仍然无法获取文件:
MariaDB [(none)]> SELECT USER();
+------------------+
| USER() |
+------------------+
| matias@localhost |
+------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> SELECT LOAD_FILE('/home/matias/test.txt');
+------------------------------------+
| LOAD_FILE('/home/matias/test.txt') |
+------------------------------------+
| NULL |
+------------------------------------+
1 row in set (0.00 sec)
有人能指出解决这个问题的正确方向吗?
【问题讨论】:
标签: mariadb