I wonder what are the GDPR constraint on a MySQL DB for a multitenant SaaS application. While a solution with a single DB per each multitenant customer and restricted access will probably be fine, what about a single DB?

How do I guarantee a proper insulation of data for single tenants? Pure applicative solutions seems weak to me (...where tenantID=xx for each query).

Will I be forced to create restricted views on each table or for most queries? How well will MySQL 6.7 handle this? I've read about indexing views and performance, I'm not sure what will happen to my application if I switch every table to a view.

Have new versions of MySQL improved? Should I use a db proxy like MaxScale? Or maybe it's reason enough to switch to postgres or other db?

  • List the requirements set out by GDPR compliance.
    – Rick James
    Oct 12, 2019 at 0:26
  • @RickJames good question...the only requirement I understand is a generic "privacy by design"
    – Glasnhost
    Oct 12, 2019 at 8:47

1 Answer 1


Regardless of how you solve the problem, you have to go through some sort of "router". And that may be the least secure part.

Separate computer for each customer -- you need to tell user which machine to go to.

Separate process or API or VM on same machine -- user must log into the appropriate path.

Separate databases (one per customer) on single MySQL server -- either API or MySQL could handle security.

Single database, but separate rows in the tables -- Now the API must take responsibility for security. That is, the user must not have direct access to MySQL, only indirect through an API layer.

Each has "privacy by design".

  • indeed the key for single database is "access to MySQL, only indirect through an API layer"
    – Glasnhost
    Oct 13, 2019 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.