Discrepancy between size of database listed in Unix and Mysql

Solution 1:

This is a very common question which has been asked many times.
This is because you are storing all the tables in a single InnoDB file (ibdata1). This file does not shrink after data is deleted, ever. So at one point you had 22gb of data stored in all your InnoDB tables, even though you may not have that much now.

To solve this issue you need to drop all your InnoDB tables, shut down MySQL, delete that file, start MySQL back up, and then re-import those tables.

Also you can use the MySQL setting innodb_file_per_table to split each InnoDB table into its own file. The files will still not automatically shrink, but you can issue a cleanup with alter table ... type=innodb.