disk quota in MySQL

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Is there a way to assign a limit on the size of a specific database? For
example database A can take up no more than 500 MB.
One of my databases can potentially grow without any bounds and possibly
stop other critical databases from operating.
We are using MySQL 4.0.21 on Linux. We use innodb tables.

- Rajesh

Re: disk quota in MySQL

Rajesh Kapur wrote:
Quoted text here. Click to load it

This question comes up on this newgroup from time to time.
I've searched for a solution, but there are no satisfactory ones.

Some solutions involve having a scheduled job detect when a database has
exceeded the authorized space, and then raise it to the attention of the
system administrator.

Some solutions involve trying to use the operating system's quota
enforcement (where available), but this solution is complex and usually
insufficient, because MySQL databases are generally all owned by one
user id, and stored under one directory.  So unless the quota
enforcement can be made per-directory or per-file, it's hard to use this
way.  Also, InnoDB tables are all stored together in one physical file,
regardless of how many databases they belong to.

Some solutions involve putting the database files on separate
filesystems, and symbolically link them into MySQL's data directory.
When the filesystem fills up, further writes get fatal errors.  But this
is not a very good strategy for graceful error handling.

MySQL has no built-in property to define and enforce a limit to the size
or number of records in a database or table.  At least, not that I've found.

Bill K.

Site Timeline