MySQL Forums
Forum List  »  Newbie

Problem with LOAD_FILE
Posted by: Tim Underwood
Date: June 26, 2012 10:50AM

I am trying to load the contents of a binary file into a table, which has a largeblob field type. This is on a Linux system (Ubuntu) running mysql 5.5.24.

An example of the command:
insert into table1 (col1, blob1) values ("A", LOAD_FILE('/tmp/somefile.zip'));

I get no errors, but ALWAYS get a NULL result. After much research and heartburn, I've found the ONLY way I get the import to succeed is if the files owner is 'mysql'. I've tried various permission settings, etc, but NOTHING works until I change the owner.

For my purposes, this is an issue. My intended use is to capture the output of a report (in a bash shell script), zip the report into a zipfile, and insert the record into the table (using load_file to get the zip contents into the file). However, the user will not have access to changing ownership of the output zipfile, so this is a big issue. I could use sudo, but since the script in question is at the long end of several binary programs, I can't popup and ask for a password using "sudo". I also don't want to configure "sudo" to be wide open and not ask for a password, even for specific users.

No - this has nothing to do with FILE privileges, or max_allowed_packet, etc. It is STRICTLY the issue of who the file owner is when attempting the LOAD_FILE. So, is there some other directive, etc. to get around this issue?

Options: ReplyQuote


Subject
Written By
Posted
Problem with LOAD_FILE
June 26, 2012 10:50AM
June 29, 2012 08:26AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.