List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 5 1999 7:32pm
Subject:Re: Overwrite data infile
View as plain text  
At 3:17 PM -0400 5/5/1999, Sweeney, Darren L wrote:
>i am doing a select into an outfile. i would like that everytime the select
>is run that the file in the /data/db_name/ dir is overwritten, but when i
>try it it does not overwrite nor does it write the file at all.
>is there anyway to do this or am i missing something?

You cannot do it.  For security reasons, SELECT ... INTO OUTFILE will
not overwrite existing files.  Suppose the server is unwisely run as
root.  Then anyone with the file privilege could cause the server to
overwrite any file on the system!  Suppose the server is, more wisely
run as a regular user.  Then anyone with the file privilege could still
cause havok, because the server could be made to overwrite any file
the server user has write permission on -- for instance, the mysql
grant tables, or any file in your database.

You'll have to arrange somehow for your file to be deleted by some
process external to the server.  Or maybe write a clever UDF, but then
someone may find out about it and use it to destroy your database.

Paul DuBois, paul@stripped
Northern League Chronicles:
Overwrite data infileDarren L Sweeney5 May
  • Re: Overwrite data infilePaul DuBois5 May