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()
:
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.
I had the same issue.
Fond out that the file to be loaded, needs to be in the folder location where mysql/mariadb has privileges to read it. It can be configured, BUT the data folder is already has access right.
In my case I copied my file to data folder: C:\Program Files\MariaDB 10.3\data And than I just called it with full path:
select load_file('C:\\Program Files\\MariaDB 10.3\\data\\test.txt');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With