Where does mysql store data? I found out (by using mysql>SELECT @@datadir ) that it's in var/lib/mysql – but that can't be it. I have a quite big database (4 GB) called 'bot', but all the files in the 'bot' subdirectory (var/lib/mysql/bot) have only 280KB. Where is the rest?
One more thing – 99% of the database's size is a text column in one of the tables – I know that mysql stores it in separate files, but does it create one file per record?
Best Answer
If you're using InnoDB and have a reasonably default configuration, tablespace data is in the
ibdata
files, you should have at leastibdata1
by default.You may want to read up about its configuration:
https://dev.mysql.com/doc/refman/5.7/en/innodb-configuration.html
Specifically splitting it so that each table gets its own ibdata file:
https://dev.mysql.com/doc/refman/5.7/en/innodb-multiple-tablespaces.html
And there are some related questions:
Ibdata usage and Recommendations?
If you're not using InnoDB, disregard that :)