Test how to store the video file in MySQL data, of course, do not recommend direct storage, because the migration will be cumbersome and prone to problems, the following is just a test function, import jpg, PNG and other pictures similar.
Create a test table, use Longblob or Mediumblob
CREATE TABLE Test (id INTEGER not NULL PRIMARY key,name VARCHAR (), movie Longblob);
Then import the video file
INSERT into Test VALUES (1, ' Titanic ', Load_file ("/tmp/good.mp4"));
Note that the following error may occur if you do not use Longblob
PS: About the Direct deposit picture on the MySQL above has two points benefits:
Easy to do weight, is the same picture only save one.
The most important backup uses the database in a simple way.
Easy to manage, remove unwanted pictures, etc.
Disadvantages:
Not suitable for a large amount of storage, the larger the data storage, the more trouble recovery
Of course, generally still need to do more physical cache, rather than rely on MySQL to direct output.
In short, if the picture is a small picture, like a forum used, and need to pay attention to his advantages can be used, as for the quantity is not specific, you have to think about if the database encountered problems, his redo and migration is convenient. In fact, if it is not a special case of the general existence of the database is not a good choice. Balance his pros and cons.
This article from the "Old Xu's private dish" blog, please be sure to keep this source http://laoxu.blog.51cto.com/4120547/1222046
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/MySQL/