Reduce DB size by truncating table - jigneshpshah/greycube_helpmanual GitHub Wiki
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema
order by "Size (MB)" desc
SELECT table_schema as `DB`, table_name AS `Table`,
ROUND(((data_length + index_length) / 1024 / 1024), 2) `Size (MB)`
FROM information_schema.TABLES
where table_schema = 'hotel13'
ORDER BY (data_length + index_length) DESC;
OR if Database name is not known
SELECT table_schema AS DB_NAME, TABLE_NAME, ROUND((DATA_LENGTH+INDEX_LENGTH)/1024/1024,2) AS TABLE_SIZE_in_MB
FROM information_schema.TABLES
where TABLE_SCHEMA <> 'information_schema' -- and table_schema = ''
Order By TABLE_SIZE_in_MB desc
truncate table `tabEmail Queue` ;
truncate table `tabEmail Queue Recipient` ;
truncate table `tabDeleted Document`;
alter table `tabEmail Queue` Engine=InnoDB;
alter table `tabEmail Queue Recipient` Engine=InnoDB;
alter table `tabDeleted Document` Engine=InnoDB;
cd /var/lib/mysql
du -sh *