每个客户端的MySQL数据库 [英] MySQL Database for each client

查看:65
本文介绍了每个客户端的MySQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要有关此主题的一些信息。我进行了一些搜索,但这似乎确实取决于您的情况。我的情况在下面进行了解释:

I need some info on this subject. I've searched around a bit but it seems that it really depends on your situation. My situation is explained below:

我们开发了一个系统,可以在公司中跟踪他们的项目和财务状况。他们可以创建订单,在员工之间划分任务,发送发票,检查是否已付款等。

当前,我们有1个域,其中1个数据库全部该公司的数据。我们也希望将此系统也用于其他公司,但要在1个域中为每个公司使用相同的文件。因此,我们可以将文件保存在一个位置,并将所有内容保存在我们自己的服务器上。

Currently we have 1 domain with 1 database with all the data for this company. We would like to use this system for other company's as well, but on 1 domain with the same files for every company. So we can maintain the files on 1 place and keep everything on our own server.

出于以下原因,我们要使用多个数据库:

We want to use multiple databases for the following reason's:


  • 我们要将文件保存在1个位置,更易于维护和更新

  • 客户不能偶然访问另一个客户的财务数据

  • 我们可以对客户数据进行个性化备份

我认为缺点是:


  • 如果需要更新表中的内容,则必须在每个数据库中手动进行更新

  • 在100多个数据库后,MySQL真的会变慢吗?

我正确吗,我们是否通过向每个公司提供一个独立的数据库来做正确的事情?

Am i correct, and are we doing the right thing by giving every Company an induvidual database?

预先感谢!

推荐答案


我们希望文件位于1个位置,易于维护和更新

We want the files to be in 1 place, easier to maintain and update

正如您已经提到的缺点,如果更新需要对数据库进行修改,该怎么办? e的架构?与单个数据库(在相关表中带有 client 个指示符列)相比,拥有数百个数据库将同样难以维护。

As you already mention under downsides, what if an update were to require a modification to the database's schema? Having hundreds of databases would be just as problematic to maintain, versus a single database (with client indicator columns in the relevant tables).


一个客户不能偶然访问另一个客户的财务数据

A client can't have acces to another clients financial data by accident

客户端只能通过您的Web应用访问数据。如果由于意外或其他原因而破坏了安全性,那么除了阻止同一数据库中的意外记录之外,还要如何阻止它访问其他数据库?

But clients can only access the data through your webapp. If that becomes compromised, by accident or otherwise, what is to stop it accessing other databases any moreso than unintended records in the same database?

视图可以提供类似的安全性优势(尽管当前存在一些性能成本)。但是,我倾向于创建存储过程并强制我的应用通过它们执行所有数据库操作,其中我可以执行自己的安全检查,同时将所有数据库访问限制为仅预定义的操作。

Views could provide similar security benefit (albeit currently with some performance cost). However, I tend to create stored procedures and force my apps to perform all database actions through them, wherein I can perform my own security checks whilst limiting all database access to only predefined operations.


我们可以对客户端数据进行个性化备份

We can make induvidual backups of clients data

一个人仍然可以进行选择性备份,例如与 SELECT ... INTO OUTFILE

One could still make selective backups e.g. with SELECT ... INTO OUTFILE.

这篇关于每个客户端的MySQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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