Unable to LOAD_FILE in Maria DB

You are viewing an old version of this question. View the current version here.

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_nameValue

+------------------+-------+

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?

Note : I asked exactly this in StackOverflow here : https://stackoverflow.com/questions/60470783/unable-to-load-file-in-maria-db

Answer

Does it work if you change the owner of the file to the mysql owner?

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.