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:
We have developed a system where in a company can keep track of their projects and financial situation. They can create orders, divide tasks between employees, send invoices, check if they are paid, etc.
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:
- We want the files to be in 1 place, easier to maintain and update
- A client can’t have acces to another clients financial data by accident
- We can make induvidual backups of clients data
Downside’s in my opinion are:
- If something in a table needs to get updated you have to do that manually in every database
- Could MySQL get really slow after 100+ databases?
Am i correct, and are we doing the right thing by giving every Company an induvidual database?
Thanks in advance!
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
clientindicator columns in the relevant tables).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.
One could still make selective backups e.g. with
SELECT ... INTO OUTFILE.