Permission denied when using LOAD DATA INFILE
I'm trying to import a CSV file into a table using the following syntax:
LOAD DATA INFILE '/home/user/test.csv' INTO TABLE table_name;
and I get the following error: ERROR 13 (HY000): Can't get stat of '/home/user/test.csv' (Errcode: 13 "Permission denied").
I'm running the above SQL statement as the MariaDB root user who has all privileges. Also the file is accessible by the "mysql" user (MariaDB server runs as mysql). I tried reading the file as "mysql" user and I have read access (the file is readable and the parent directories have read and execute permissions set).
Is there something else that could block access to MariaDB server to certain directories? For example if I place the same file I want to import under /tmp/ I can successfully import it.
I'm running MariaDB server 10.6.5 on an Ubuntu 20.04.3 server (kernel version: 5.4.0-91).
Thank you in advance.
Answer Answered by Daniel Black in this comment.
The systemd default directive ProtectHome restricts access of home directories by system services.
See: https://mariadb.com/kb/en/systemd/#configuring-access-to-home-directories