Created
April 20, 2016 03:48
-
-
Save CodeKiwi/f07fd4a73ae4523b8d10bc4d0cdb40f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 <table> | |
| #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"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment