When a user registers on my site, they have their own table created in one of my databases. This table stores all of the posts that the user makes.
What I would also like to do is also generate them their own MySql user – which ONLY has permission to read, write and delete from their table.
Creating that shouldn’t be a problem – I’ve got Google for that.
What I’m wondering is, let’s imagine that I clock myself 10,000,000 or more users at one point in the future, would having that many MySql users affect my database performance?
For the sake of answering your question, a quick points… before I explain why you are doing it wrong…
The performance hit will come from having massive amount of tables. (The limit is massive so should you ever reach that high, I would for gods sake hope that you recruit someone who can slap your database silly and explain why you have mutilated it so much). Excuse the harshness 🙂
Okay, now onto how you should actually be doing it.
Multi-Tenancy
First, you need to learn about how to design a database that is designed for multi tenant application. This is exactly what you are creating by the sounds of it, but you are doing it COMPLETELY wrong. I cannot stress that enough.
Here are some resources which you should read immediately.
Then read this question:
– How to design a multi tenant mysql database
After you have done that. You should learn about ACL (Access Control Lists).
If you explain what sort of data you are trying to model, I will be happy to update this post with a simple table schema to match what you might require.