MySQL cannot create file (permission denied). even my folder permission is 1777 (Ubuntu) hello I have some issue with my MySQL db. I've try so many ways to fix it, but it cannot solve my problem. I tried this Cannot output MySQL data to file. and still have same error.

this is my query and error result : 


  mysql> select * from categories into outfile
  '/var/www/html/project_pfm/output/file2.txt';
  
  ERROR 1 (HY000): Can't create/write to file
  '/var/www/html/project_pfm/output/file2.txt' (Errcode: 13 - Permission
  denied)


and this is my file permission in OS : 


  root@WebPFI01:/var/www/html/project_pfm# ls -al
  
  drwxrwxrwx  3 mysql mysql      4096 Apr  6 09:35 output


thank you for your help and answer.
Ubuntu ships with AppArmor which may be causing your issues. You might want to look at some of the discussion at https://stackoverflow.com/questions/2783313/how-can-i-get-around-mysql-errcode-13-with-select-into-outfile