I was trying to write the output of a select statement to a tab-delimited text file. I
could not write the file to a folder inside /var/www or to my home file because of
permission problems. After a moment's reflection, I realized /tmp had stuff written to it
all the time, so its permissions must be wide open. I tried writing the file to /tmp and
it worked fine. Since you cannot write to an existing file, you cannot create the file in
advance and set its permissions. What is the trick to getting the file to write
successfully anywhere you want it to be written?
This is the query I was
using...
mysql> select sched_students.id, firstName, lastName, grade, race, gender,
dob, school, phone, program, hsMath, hsEnglish, hsScience, major, 9YBand, 9YChorus,
9YGifted, 9YTV, 9YROTC, 9YSpanishI, 9YSpanish2, 9YFrenchI, 9SAerobics, 9SArt,
9SBasketball, 9SDrama, 9SDriverEd1, 9SDriverEd2, 9SRecreation, 9STeamSports1,
9STeamSports2, 9SWeights
into outfile '/tmp/srhs9.txt'
from sched_students, SCHED_COURSES where (sched_students.id = SCHED_COURSES.id) and
(grade = 8) order by lastname, firstname;