#Logs into MySQL with root account and asks password
mysql -u root -p
#Show the items for the selected type
show databases|tables|columns in
#Show count of articles older than 30 days
SELECT COUNT(*) FROM articles WHERE date < DATE_SUB(NOW(), INTERVAL 30 DAY);
#Delete articles older than 30 days
DELETE FROM articles WHERE date < DATE_SUB(NOW(), INTERVAL 30 DAY);
#Show size of tables
SELECT TABLE_NAME, table_rows, data_length, index_length, round(((data_length + index_length) / 1024 / 1024),2) "Size in MB" FROM information_schema.TABLES WHERE table_schema = "dyor_data";