Ok, it was me only who asked this question. Now I have found a solution to this.
Let the default MySQL datadir be /var/lib/mysql
Suppose you have a user foo on the system as well as on MySQL. Now how to limit space for foo ?
create a separate directory for databases in foo's home say /home/foo/dbs with ownership mysql:foo and permissions 3755.
Now move all foo's databases from /var/lib/mysql to /home/foo/dbs
Then create symbolic links to the database named folders.
Example there is one foo's db called db1 in /var/lib/mysql/db1
Code:
# mkdir /home/foo/dbs
# mv /var/lib/mysql/db1 /home/foo/dbs/
# chown mysql:foo /home/foo -Rf
# chmod 3755 -Rf /home/foo
# ln -s /var/lib/mysql/db1 /home/foo/dbs/db1 -v
NOTE- I AM NOT RESPONSIBLE FOR ANY DAMAGES OCCURRED & TO TEST THIS TRY RESTARTING mysqld.
if mysqld starts OK then its working else it isn't.