使用mysql或文件存储数据更好吗? [英] Is it better to use mysql or files to store data?

查看:111
本文介绍了使用mysql或文件存储数据更好吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道使用mysql还是使用文件存储数据更好?什么更安全,什么更快?我说的是php和mysql.

I'm wondering if it's better to use mysql or use files to store data? What is safer, what is faster? I'm talking about php and mysql.

推荐答案

这完全取决于您的要求和设置.

It completely depends on your requirements and setup.

对于不需要复杂查询的少量数据,文件速度更快.网站缓存就是一个例子.

For small amounts of data that doesn't require complex querying, files are faster. Site caches are one example.

对于较大的数据集或具有更多结构的数据集,数据库将使您能够以更高级的方式查询数据.

For larger data sets or sets with more structure, a database will enable you to query your data in more advanced ways.

出于安全考虑,可以保护文件(使用权限)并将其存储在Web根目录之外.数据库可以锁定到某些主机,并且可以使用户具有不同的角色/权限.

In terms of safety, files can be protected (using permissions) and stored outside the web root. Databases can be locked to certain hosts and can have users with different roles/permissions.

这篇关于使用mysql或文件存储数据更好吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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