MySQL – Resolving Hidden Files Taking Up Space on Ubuntu

MySQLUbuntu

I have a weird issue where my system (ubuntu 19) is showing that MySql 8 is using up 600gb of space, when it should be closer to 250gb.

I ran ubuntu's baobab utility in sudo mode, and it as well, is showing that MySQL is using up 250GB . Any idea what could be taking up the other 250GB?

I also ran this query via SQL, to show table sizes – same story ~250GB, so not sure what else I could try.

SELECT 
     table_schema as `Database`, 
     table_name AS `Table`, 

     round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` 
FROM information_schema.TABLES 
ORDER BY (data_length + index_length) DESC;

.. I do have a few indexes set up, but most of them on columns containing 0/1s

Thank you in advance for suggestions.

Best Answer

looks like this command worked for temporary solution:

PURGE BINARY LOGS BEFORE '2019-10-19 22:46:26'; #your date

(mysql manual)

Still working on the long term solution. Per mysql manual - these were the logs of select statements (which are typically huge in my case). Not 100% yet on whether I need these :) In either case, thank you everyone for helping troubleshoot. This was blowing my mind for a bit, but all it took was browsing into the folder itself, and seeing hundreds of huge files!