MySQL cannot create file (permission denied). even my folder permission is 1777 (Ubuntu)
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