MySQL Forums
Forum List  »  Newbie

Re: null in blob column during inserting an image
Posted by: charles whitehead
Date: May 15, 2020 08:38PM

I was able to get this to work after some time here is what I had to to do.


On windows

1.In Workbench I ran the Query show variables like "secure_file_priv";
2.This will give you the directory which the file needs to be places in order to use the load_file command.
3.if you do not want to use the directory from step 2 do the following this will allow you to use any directory on the PC
-1.Stop the MySQL server service by going into services.msc. Or simply stop mysql using the mysql notifier

2. Go to C:\ProgramData\MySQL\MySQL Server 8.0 (ProgramData was a hidden folder in my case).

3. Open the my.ini file in Notepad.

4. Search for 'secure-file-priv'.

5. Comment the line out by adding '#' at the start of the line. For MySQL Server 5.7.16 and above, commenting won't work. You have to set it to an empty string like this one - secure-file-priv=""

6. Save the file.

7. Start the MySQL server service by going into services.msc.


To use the file load command use must use forward slashs and not back slashs for example

load_file(C:/ABC/DEF/me.file)


On Unbunto

1.In Workbench I ran the Query show variables like "secure_file_priv";
2.This will give you the directory which the file needs to be places in order to use the load_file command. You most also have permissions to this folder in my server it was /var/lib/mysql-files
3. Put the files you want to upload to the DB in this folder this run the load file command


load_file(/var/lib/mysql-files/me.file)

Options: ReplyQuote




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.