0

I am using Maria DB on Ubuntu 1804 :

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

I want to do something relatively easy and I have wasted 2 hours on it. I want to load a file as a string. There are several questions (many of them really old) on this site but none of them lead me to a solution and I have tested everything til reaching total frustration.

Granting privileges :

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)

No secure_file_priv :

MariaDB [(none)]> SHOW VARIABLES LIKE 'secure_file_priv';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| secure_file_priv |       |
+------------------+-------+
1 row in set (0.00 sec)

Right permissions on the file :

[~]@Ubuntu1804  #> ls -lh test.txt
-rw-rw-r-- 1 matias matias 6 Feb 29 23:44 test.txt

And still cant get the file :

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)

Can someone point me on the right direction to solve this?

1 Answer 1

0

Well, I tried EVERYTHING under the sun and it never worked.

So I tried with Ubuntu 19.10 instead of 18.04 and it works like charm,

so unless someone has some magic card on his sleeve this is the only workaround I could come up with.

All in all, it works in Ubuntu 16.04 and 19.10.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.