mysql table dump problem

From: Date: Sun, 21 Jan 2001 01:57:25 +0000
Subject: mysql table dump problem
Groups: php.general 
Request: Send a blank email to php-general+get-35868@lists.php.net to get a copy of this message
Hi list, I have scoured the archives with no good game plans. Here is what I am trying to accomplish: dump a table to a file on my server: $sql = "SELECT * INTO OUTFILE '/tmp/test.txt' FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' FROM table_name"; take the file and email it to someone: using a mime-mail class from http://phpclasses.upperdesign.com The above works perfectly. I am able to create the file and email it to a designated address. Problem is that once I have created the dump file, it will not allow me to overwrite it and it gives me an error. Error = rm: cannot unlink `test.txt': Operation not permitted. It is owned by mysql:mysql. So it looks like it must be deleted by root or I need to change the ownership of the file so it can be deleted. So... What is the best way to remove the file before re-dumping it to the /tmp directory? I'm not sure if it is possible to switch to root...but I know that is probably a very bad idea. How can I change the ownership of the file so it can be deleted from PHP code? TIA, Scott P.S. Please cc: me on any responses as I am no longer a member of the list.

« previous php.general (#35868) next »