I am trying to insert an image into my MySQL server. I have done some research and it looks like the best way to do that is through LOAD_FILE()
. However, LOAD_FILE()
always returns null. I know there are 4 conditions for LOAD_FILE()
:
- The file must be located on the server host
- You must specify the full path name to the file, and you must have the FILE privilege.
- The file must be readable by all and its size less than max_allowed_packet bytes.
- If the secure_file_priv system variable is set to a nonempty directory name, the file to be loaded must be located in that directory.
I am currently using:
select LOAD_FILE('/Users/pricedb/Desktop/FolderName/imageName');
and it returns NULL
I have confirmed that all privileges are granted to the user. What does it mean that the file must be located on the server host? The server is being run off my local computer and and file is located there, so does that mean I am good on that?
Any advice would be greatly appreciated, I do not know why it's not returning a value.