Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to store video in database using mysql?

Tags:

mysql

video

store

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.

like image 468
Dnyani Avatar asked Apr 30 '12 12:04

Dnyani


People also ask

Can we store video in MySQL database?

Of course you can. But database including MySQL is not good at storing unstructured data like pictures, video, mp3, etc. If you just store a few small files ,it's OK, but if you want to scale out to store a lot of files, you should chose another way.

Can we save video in SQL database?

If you want to store videos in a SQL Server database, you can use VARBINARY(MAX) (which is a way of saying you want to store a binary large object). You can also enable FILESTREAM access so that SQL Server can save your video as a file on the file system.

Can we store video in database?

Storing videos and images directly in database is not a viable solution. The ideal way is to store images and videos in CDN and save that file path in DB. Advantage of storing in CDNs, data will be served from edge server's(cached) rather than from source.

Which database is used for storing videos?

Best Answer. Oracle NoSQL Database provides a Large Object interface that is intended to be used to read and write large objects such as audio or video data.


1 Answers

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.

like image 140
adrien Avatar answered Oct 20 '22 11:10

adrien