how to store video in database using mysql?

Dnyani picture Dnyani · Apr 30, 2012 · Viewed 54.5k times · Source

I try to store a video file into database using MySQL, But i don't known how do store video file into database. I try following query but it didn't work.

     CREATE TABLE GAME  (
               GAME_ID INTEGER NOT NULL PRIMARY KEY,
               GAME_NAME VARCHAR (20),
               VIDEO  LONGBLOB );


INSERT INTO GAME  VALUES(3, "Termonator2", 
LOAD_FILE("C:\Users\Public\Videos\Sample Videos"));

Please give me any reference or hint.
Any help is appreciated.

Answer

adrien picture adrien · Apr 30, 2012

I would advise you to store the video file in a file directory, and only store the filename in your MySQL database.

This way, you can keep a light database.