How to clean Magento 1.x database
When I try to make a copy of the Magento 1 site, it takes forever to restore the MySQL database. The size of the database was 8.6 GB. On checking, I found some tables like report_event are very large.
To clear the tables, Magento provides a script, you can run it with
php -f shell/log.php clean --days 2
This will delete all logs that are 2 days old from the MySQL database. If you need to keep logs for 60 days, you can use the following command
php -f shell/log.php clean --days 60
After running the log cleaner script, the size of the database changed from 8.6 GB to 829 MB.
If you need to clean MySQL database manually using phpMyAdmin or MySQL command prompt, you can run the following SQL commands
Using Magento Backend
You can log in to the Magento Admin area, then go to
System > Configuration > Advanced > System > Log Cleaning
You have the option to auto clean the Magento store logs.