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

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

clean magento 1 mysql database

After running the log cleaner script, the size of the database changed from 8.6 GB to 829 MB.

magento database size before and after cleaning

Cleaning Manually

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

You have the option to auto clean the Magento store logs.

Leave a Reply

Your email address will not be published. Required fields are marked *