Yes, what you want is called "safe mode".
In safe mode, php scripts operate as the owner of the directory they are in, with their permissions et. al.
If you set up a database for each user, they can then each hit their own database, and when they hit the big community database, they hit it with their own id and permissions.
I've done something similar for a trial at work with postgresql and it worked fine. The best part is no one had to set name/password pairs in their scripts, reducing security exposure.