Mysql – Each thesql database with its own user

database-designMySQL

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.

Best Answer

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.