MYSQL files occupied whole disk, which file to delete to recover

SYSTEM INFORMATION

Ubuntu 20.04
Webmin 1.994
RAM: 1GB
vCPU: 1

My Webmin displayed an error message saying the disk is full. Upon investigation, I found 3 files inside
/var/lib/mysql has grown too big.

  1. mysql.ibd (8.8G)
  2. undo_001 (8.4G)
  3. undo_003 (2.5G)
    I googled to check whether these files can be removed (rm) but the suggestion was against mysql.ibd
    while no clear information on undo_001 & undo_002.
    How can I safely remove files and which one to restore to the server? As of now, 0 bytes is free, and nothing I can do on the server.
    Another question is how to prevent these files from growing so big.

Thank you

Man I wish I documented this problem. I only had it once and after quite a bit of Googling I managed to fix it. One of my network admin friends just called me with a fresh installation of Virtualmin and he has the same problem. Now he can’t even start MySQL anymore.

this may help https://dba.stackexchange.com/questions/142653/mysql-ibd-file-is-too-big

Thanks @jimr1 ,

That post has no accepted answer yet on stack, and seems to refer to the generic growth of a table. I think what our user was dealing with is rather a bug or something, but either way, he seems to have reverted to stack and gotten an accepted answer here:

To me it looks like this sequence might do the job, provided you still have control over your database:

ALTER UNDO TABLESPACE tablespace_name SET INACTIVE;
DROP UNDO TABLESPACE tablespace_name;
SET GLOBAL innodb_undo_log_truncate=ON;