ERROR 1 (HY000): Can't create/write to file (Errcode: 13 - Permission denied)
Not sure if this applies to your situation but I ran into similar problems on RHEL 8.
First gotcha is that systemd was configured to run the MySQL service with the privateTmp option (see https://www.freedesktop.org/software/systemd/man/systemd.exec.html#PrivateTmp=).
This means that when you write to /tmp it actually attempts to write to a directory named something like /tmp/systemd-private-&lt;random&gt;-mariadb.service-&lt;random&gt;
Secondly the directory you write to needs to be owned by mysql (and group mysql).
Lastly the SELinux context needs to be correct as well when SELinux is Enforcing.