LOAD DATA INFILE not working in docker container setup

The mariadb database container already supports load data infile:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 11.7.2-MariaDB-ubu2404 mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

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

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

MariaDB [(none)]> exit

The Matomo config file is also correctly set:

[database]
host = "TEMP"
username = "TEMP"
password = "TEMP"
dbname = "matomo"
tables_prefix = "matomo_"
port = 3308
adapter = "MYSQLI"
schema = "Mariadb"
charset = "utf8mb4"
collation = "utf8mb4_uca1400_ai_ci"
mysqli.allow_local_infile = On

[General]
curl_timeout = 10000
force_ssl = 1
assume_secure_protocol = 1
proxy_uri_header = 1
enable_trusted_host_check = 0
salt = "TEMP"
trusted_hosts[] = TEMP
proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
proxy_host_headers[] = "HTTP_X_FORWARDED_HOST"
cors_domains[] = TEMP
noreply_email_address = "temp"
mysqli.allow_local_infile = On

Nevertheless I get the matomo warning in the system check:

Datenbankfähigkeiten:

:heavy_check_mark: UTF8mb4 charset :heavy_check_mark: Connection collation :warning: Warning: LOAD DATA INFILE
Tipp: Wenn Sie LOAD DATA INFILE verwenden, indem Sie Ihre PHP- und MySQL-Software aktualisieren und sicherstellen, dass Ihr Datenbankbenutzer das FILE-Recht hat, wird der Archivierungsprozess von Matomo erheblich beschleunigt.
Sie sollten dieses Problem beheben, wenn Ihr Matomo-Server Webseiten mit hohem Traffic (z.B. über 100.000 Seitenansichten pro Monat) verarbeiten muss. :heavy_check_mark: CREATE TEMPORARY TABLES :heavy_check_mark: Changing transaction isolation level

There are lots of posts and this is a common problem but there is no clear documentation on Matomo side how to fix this issue.

Any ideas what is still missing in my configuration?

If I go a step further and grant the matomo user access manually, it still doesn’t work:

ariaDB [(none)]> GRANT FILE ON *.* TO 'testuser'@'%';
Query OK, 0 rows affected (0.004 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> SHOW GRANTS FOR 'testuser'@'%';
+------------------------------------------------------------------------------------------------------+
| Grants for testuser@%                                                                                  |
+------------------------------------------------------------------------------------------------------+
| GRANT FILE ON *.* TO `testuser`@`%` IDENTIFIED BY PASSWORD '*REMOVED_VALUES' |
| GRANT ALL PRIVILEGES ON `matomo`.* TO `testuser`@`%`                                                   |
+------------------------------------------------------------------------------------------------------+
2 rows in set (0.001 sec)

(testuser is of course the correct matomo user)