2

I developed a web app in which each company that registers on the app gets its own database with its own mysql-user credentials. Is this approach fine OR can I use one master mysql-user account to connect to and administer all the databases of various companies in my web app? The companies don't care how I have implemented the backend.

2
  • What are your concerns, how would you like to optimize? Are there performance, backup or security concerns? Do you plan to grow your web app to something that needs to be provisioned or deployable? Or did you just promised every client a seperate database because that sounds good?
    – Jeroen
    Jan 5, 2016 at 21:34
  • @Jeroen I didn't promise every client a separate database. The reason each company has its separate database is that the app was built initially for a single company and lot of work was done on it. Now my only concern is that what if one company's user access and change the data of another company via web app through some glitch. Jan 6, 2016 at 7:41

2 Answers 2

0

I would opt for different users accounts for each database.

If you implement the logon module seperately from the rest of the application, you have something that looks more like a portal to individual provisioned environments. That leaves you with more options in the future.

The only drawback I can think of is that this could lead to many database connections, not sure when that is a performance killer.

Having one connection to the database (and thus one session), means you have to switch between databases while handling requests from different companies. You should investigate how this affects performance as well.

0

It's up to you. Each has it's advantage and disadvantage.

One user for each webapp means more admin in creating users, more users and passwords to keep track of, but means a much reduced potential for damage if one of those web applications is compromised somehow.

One global user is simple to set up, simple to administer, but that one user has an awful lot of power. One web application being compromised would lead to all web apps being compromised.

My preference would be for one user per webapp. Unless you're getting to large numbers of apps/users, then this scales well and gives you more control. Even when it does get to large numbers, there are ways of controlling for larger numbers of connections.

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.