Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 07-10-2007, 01:57 AM   #1
LQ Newbie
Registered: Sep 2005
Posts: 19

Rep: Reputation: 0
limit Mysql database size per user account


I want to know whether there are any way to limit the storage size for a mysql database per user so that my hard disk space will not compromise by only one user.

Old 07-10-2007, 06:48 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
I couldn't find a table size limit setting in the mysql manual. You can limit things like connections and updates per hour. You can limit a users filesize limit in /etc/security/limits.conf.
Old 07-10-2007, 01:49 PM   #3
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 235Reputation: 235Reputation: 235
One possible way to add quotas would be to map each users database to their /home directory (with quota's setup on that partition) or add user quota's to /var where mysql databases reside by default. The only downside to this would be that you'd have to change the ownership of each users database directory to be owned by them but also allow mysql to write to the database by keeping the same group permissions owned by mysql and or allowing full access by all.
Old 07-10-2007, 02:58 PM   #4
Senior Member
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
I would probably look into using container files that contain a file system. These can be mounted using a loop device. You could have one container file per user. Each container file could be whatever size that user needs. It would be impossible for the database contained in each container file to exceed the size of the container file. The container files are all owned by root so they cannot be deleted by the end user. Once the container file is mounted as a file system then the file ownership of the database files takes over.

The only real drawback is that your backups would back up the container files so the backup would include the free space in the container files. You could get around this but I think it is better to back up the container files than to back up the contents in the mounted container files.

I'm a big advocate of using container files instead of disk quotas. I think that the container files require less CPU than disk quotas. I've never proven this experimentally though.

Last edited by stress_junkie; 07-10-2007 at 02:59 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit process per user account bin_asc Linux - Security 4 05-22-2007 07:45 AM
File size limit on RedHat 3.4.5-2 with MySql joemacbusiness Linux - General 1 11-28-2006 06:51 AM
How to limit a user account even further Ashrack Linux - Security 5 04-15-2006 05:15 PM
user/folder size limit dfcc Linux - Software 5 10-08-2005 05:56 AM
MySQL size limit Robert0380 Linux - General 2 09-05-2003 03:36 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:05 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration