How to insert image directly in Mysql with command?


Hello sir,
I am trying to inset a small image img.png (57.7KB) into mysql database. Table structure is id(int) and image(blob).

I can insert the image using http://localhost/phpmyadmin but
when I try command-line using the following command:

insert into image(id,image) values (2,load_file('f:\img.png'));


insert into image(id,image) values (2,load_file('f:\\img.png'));

error occurs :-
ERROR 1048 (23000): Column ‘image’ cannot be null

I am using windws 10 os and WampServer 3.1.7 64 bit.

Please help.


i would guess the file does not exist or your command line user doesn’t have the permission to read it.