Search code examples
mysqldatabaseblobmysql-loadfile

How to insert image in mysql database(table)?


I want to insert image into a table like

 CREATE TABLE XX_SAMPLE(ID INT
                       ,IMAGE BLOB);

So can you help out form how to insert image into the above table.


Solution

  • Please try below code

    INSERT INTO xx_BLOB(ID,IMAGE) VALUES(1,LOAD_FILE('E:/Images/jack.jpg'));