I have a table with

create table pictures(
    pic_ID int,
    picture blob,
    primary key (pic_ID)

I use INSERT INTO pictures VALUES (1, load_file('/home/hai/Pictures/icon.jpeg'));
and then select * from pictures; displays this


Why it has NULL in my picture column ?

closed as off-topic by RoVo, Soren A, Kulfy, Emmet, Eric Carvalho Apr 15 at 13:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – RoVo, Soren A, Kulfy, Emmet, Eric Carvalho
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    If you are using input type='file' for uploading an image then you must have enctype='multipart/form-data' attribute in form tag. eg- <form action='' method='' enctype='multipart/form-data'> – Abhishek Kamal Apr 15 at 8:55

Standard MySQL in Ubuntu runs with secure_file_priv enabled, which means that you can't just load from (and write to) any file on your system: the file must reside in a particular directory. You can verify that this is the case using this command:

SHOW VARIABLES LIKE "secure_file_priv"

You can either turn this setting off (which is a security exposure) or find a way to move your pictures into this directory.

Not the answer you're looking for? Browse other questions tagged or ask your own question.