[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Binding MySQL DBs to users



Hi Carrie,

> By golly, I think I have a question that hasn't been solved in the
> archives - yet.  ;)
> And yes, I *did* search for it, and found a similar problem from a post a
> year ago but no clear solution.

Hmm, weird - I'm pretty sure, I answered this question on the list before
:-)

> Since Cobalt's pkg dumps all of the MySQL databases in one spot - is there
> any way that we can bind a user's database to his space? So that if his DB
> is limited by the space that he has on the server. (For example, if his

Yes,  you just need to chown the database files to the specific user.

You'll ofcourse need the MySQL daemon to access the file, and as you
shouldn't run that as root, you'll need the database files to be readable by
the group. Chgrp the files to the mysql user.

> Doing a search on Google for this gave me a one post on a mailing list
where
> a man suggested to create a script that would check each user's DB size
each
> night (drop it in cron) and email them if it started getting close to a
> certain amount so they'd know to dump it.

You could certainly do that too. I have earlier used a simple webpage, that
shows the size of the database of each user. It could probably be integrated
into the Cobalt GUI without too much trouble.

> I *could* do this, if I knew how to measure the DB size. (That's off-topic
> but if anyone knows how to do it I'd sure appreciate sharing the
> knowledge...mysql_fetch_lengths just ain't cutting it for me so far...)

It's actually _very_ easy. Just do a "ls -l" on the database files, and
you'll see how much space each table uses. So you can use something like
this to view the size of each database:

du -hs /home/MySQL/*

--
Jens Kristian Søgaard, Mermaid Consulting I/S,
jens@xxxxxxxxxxxxxxxxxxxx, www.mermaidconsulting.com
Need to check the bandwidth usage of each site on your server?
We have the solution! - Only 70$ per server.