how to store video in database using mysql?

北慕城南 提交于 2019-12-03 03:37:11

you need to add two slash in path.
Check following query.it's work with me.
use this

INSERT INTO GAME values (3, 'Termonator2',LOAD_FILE("C:\\Users\\Public\\Videos\\Sample Video\\test.mpg"));   

instead of

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

enjoy.....

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.

LOAD_FILE("C:\Users\Public\Videos\Sample Videos") is a DIRECTORY. You forgot the video name and extension.

Should be: LOAD_FILE("C:\Users\Public\Videos\Sample Videos\videoname.avi") for example.

But like everyone pointed out, this is a bad idea. Don't store videos in a database.

try

C:\Users\Public\Videos\Sample Videos\filename.ending

instead of

C:\Users\Public\Videos\Sample Videos

Just put your videos in the C: directory somewhere. The whole User/Videos thing seems to be hidden. I created a C:/videos directory and placed my videos in it!

First of all, I would suggest you to not store the video file in your database, this is a wrong approach.

Store only video file names and through which you can fetch video from a directory.

But your answer is:

INSERT INTO GAME values (3, 'Termonator2',LOAD_FILE("C:\\Users\\Public\\Videos\\Sample Video\\video.mp4"));
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!