如何将'wav'文件存储在mysql数据库中? [英] how to store 'wav' file in a mysql database?

查看:658
本文介绍了如何将'wav'文件存储在mysql数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下查询将wav音频文件存储到mySQL中。



更新文件set sample = load_file('C:\ Users \VIGNESH \ Desktop\project\VRS\test2.wav')其中number = 789;



文件是我的表名,sample是我的数据类型mediumblob的列名和number是另一栏。



当我执行上述查询时,它显示为

'查询确定,0行受影响'



音频文件没有存入数据库。请帮助我...

I tried the below query for storing wav audio file into mySQL.

update files set sample=load_file('C:\Users\VIGNESH\Desktop\project\VRS\test2.wav') where number=789;

files is my table name,sample is my column name of datatype mediumblob and number is an another column.

when i executed the above query,it is showing as
'query ok,0 rows affected'

the audio file is not getting stored into the database.please help me...

推荐答案

Refer : function_load-file [ ^ ]

Refer: function_load-file[^]
Quote:

要使用此功能,该文件必须位于服务器主机上,您必须指定文件的完整路径名,并且您必须具有FILE权限。该文件必须是可读的,其大小小于max_allowed_pa​​cket字节。

To use this function, the file must be located on the server host, you must specify the full pathname to the file, and you must have the FILE privilege. The file must be readable by all and its size less than max_allowed_packet bytes.



您必须先将wav文件上传并保存到服务器上的临时文件夹,然后使用load_file插入它进入一个mysql表。


You have to first upload and save your wav file to a temp folder on the server, then use load_file to insert it into a mysql table.


这篇关于如何将'wav'文件存储在mysql数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆