1

Since MySql does not have a built in quota tool, I wonder how the Big Companies like Daddy and Gator and so on manage their limitations for users?

I was thinking about to use some kind of script to check if the db is over a certain size, but if someone imports a huge thing in, then what? Is there a limitations for how big dump can be imported in?

Tibby
  • 215
  • 1
  • 3
  • 9
  • you don't limit the import, you run a job occasionally, that takes suitable action. – user9517 Apr 26 '14 at 19:30
  • And if someone imports a dump over 1 GB? Just let them do it? When the script runs, it will get there.... I know the script has to run from cron constantly. – Tibby Apr 26 '14 at 19:40
  • I have imported databases which are too big for the shared service I was using only to have them limited when the scrip runs. – user9517 Apr 26 '14 at 20:04

1 Answers1

2

Usually it's one of two methods:

1) Limit the disk space using a filesystem quota for the folder where the database file is hosted. This is easily accomplished using /home directories for each user and symbolic links to where MySQL looks for the database files.

2) A cron script runs every x minutes that checks for table sizes and revokes CREATE/INSERT statements for databases over the limit.

The second method won't prevent short-term abuse, but you can minimize impact by ensuring there's plenty of extra space and have policies in place to discourage abuse.

Nathan C
  • 15,059
  • 4
  • 43
  • 62
  • With Method #1 Have to configure quota for the disk for each folder containing mysql db files. Method #2 would allow users to upload gigantic databases. Is there a way to limit in mysql how big dump file can be imported? Like dump can not be larger than 1 GB ? To upload that over phpmyadmin would be hard anyway, but still... Is there such an option? Because with that It can be useful with the cron script. – Tibby Apr 27 '14 at 11:19
  • Normally, phpmyadmin is limited by the PHP upload settings so it'd be difficult to accomplish anyway. `max_packet_size` in mysql's config can be tuned too. – Nathan C Apr 27 '14 at 15:31
  • @NathanC Can you write an example for method 1 since symbolic link from database folder to quoted directory will not include the size. – Novkovski Stevo Bato Feb 15 '16 at 03:01