Helpful Information
 
 
Category: PHP / MySQL
Limiting the size of a MySQL database

Hello,

I was wondering if there is a way to limit the size of one particular MySQL database? As far as I know MySQL itself has no support for this. I want to setup a demo database and put a limit on how much junk that can be put into it.

Maybe this is possible through the use of quota in some way? Is it possible to restrict a certain directory to a maximum size? I'm not familiar with this so any help or ideas are appreciated.

Just did a quick search on this, and it looks like there is no way of doing this (not through mySQL anyway). You'd have to do it "manually", in your actual Perl or PHP script (make it check before inserting, etc.). Or what you could do is set up a cron job run at midnight every day to (for example) trim each of the tables to 10 rows, or empty them out, etc.










privacy (GDPR)