Knowledge Walls
John Peter
Pune, Maharashtra, India
How to insert blob in mysql using load_file method
38025 Views
load_file(path of file) is used to load file content as blob content in mysql database queries. It requires path of the file as parameter to read the data from the specified path to blob data.
How load_file method works in mysql
SELECT LOAD_FILE("d:/sample.txt");
Insert action using load_file to load blob content from specified file
INSERT INTO table_name (file_name,file_content) VALUES("data.txt",LOAD_FILE("d:/data.txt"));
INSERT INTO table_name (file_name,file_content) VALUES("sample.txt",LOAD_FILE("d:/sample.txt"));
Update blob using load_file method in MYSQL
UPDATE table_name SET file_content=LOAD_FILE("d:/data.txt") WHERE id = 1;
UPDATE table_name SET file_content=LOAD_FILE("d:/sample.txt") WHERE id = 2;
Previous Topics
Previous lessons of current book.
Computer software engineer articles of One day One Thing to Know
Computer software engineer articles of One day One Thing to Know
Best Lessons of "One day One Thing to Know"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details