Reputation: 158
Server version: 5.7.29-0ubuntu0.18.04.1 (Ubuntu)
I am trying to save output to file: /var/www/dir/file.csv
It gives me an error: Can't create/write to file '/var/www/dir/file.csv' (Errcode: 13 - Permission denied)
It is PHP script, executing through browser.
Permissions: /dir/ (ls -al)
drwxrwxrwx 2 mysql root 4096 Apr 29 10:40 dir
Upvotes: 0
Views: 862
Reputation: 1858
As mentioned above, you need to adjust secure_file_priv variable, but you will also need to adjust your AppArmor configuration on Ubuntu (SELinux if it was Fedora/CentOS/RedHat) to allow you to write to the directory outside of the ones already allowed.
Upvotes: 0
Reputation: 158
I have found that default dir to upload files is: /var/lib/mysql-files/
SHOW VARIABLES LIKE "secure_file_priv";
And rewrite script to write in that directory.
Upvotes: 0