I'm using MariaDB on my hosting. I would like to limit database size to 1 GB. How to do this properly in /etc/my.cnf ?
Asked
Active
Viewed 5,125 times
2 Answers
1
What do you mean by limit? Do you mean that MySQL should just refuse to write anything past the 1GB threshold? This sounds to me like you're just asking for corrupt data.
How can you achieve it? Since there is no option in my.cnf to limit a database size (Again, because this makes no sense), the best solution I can come up with is to place your mysql data directory on its own partition and limit the size of that partition to 1GB.

Kevin
- 827
- 3
- 13
- 23
0
There are two requirements for you to cap the database is 1GB
- innodb_file_per_table must be disabled
- All data and indexes must currently reside in ibdata1
Once these prerequisites are met, please locate the following in my.cnf
:
innodb_data_file_path = ibdata1:10M:autoextend
Just add this to my.cnf
innodb_data_file_path = ibdata1:10M:autoextend:max:1G
and run service mysql restart
.
Give it a Try !!!

RolandoMySQLDBA
- 16,544
- 3
- 48
- 84
-
This is good but won't work in a shared hosting environment with multiple users :/ – Spacedust Mar 23 '13 at 15:20