Although you had correctly set writable permissions on the target directory, in order for a user to traverse the directory tree into that target directory, you must supply an execute permission for that user on every higher directory leading into your target directory. This is owing to the fact that in a directory context, execute actually means look inside to list contents.
This means that the minimum (ignoring the owner/group permissions) for each of the directories in the path
/var/www/vhosts/mysite/private_www/data_export
would be 0751
, where the final 1
is an execute permission for the "other" user category. So, verify that every directory in your target path has at least execute permissions for the MySQL server user (probably mysql
in a CentOS system).
Permitting execute (list-contents) on all those directories does mean that any system user could inspect them, not just the MySQL user. Consider this as you decide where the final path will be. You might want to separate it from your www files if you can.
In your setup you have set the target directory as 0777
, world-readable, world-writable. That's not advisable if it can be avoided. Since all that's really necessary there is for MySQL to be able to write to it, consider instead changing its group ownership to the mysql
group. That will enable you to avoid making it world writable.
# Give group ownership to mysql
chown :mysql /var/www/vhosts/mysite/private_www/data_export/newdir
# And just make it writable by the group, not everyone
chmod 0770 /var/www/vhosts/mysite/private_www/data_export/newdir