How to empty eximstats database on cPanel
Eximstats MySQL database stores statistical information of email delivery by Exim mail service. If server has high email activity, this database can grow big taking up a lot of disk space and overloading MySQL service. So it is a good idea to clear out eximstats database frequently or completely disable it if you are not using the statistics stored in it.
How to clear out eximstats database periodically
Go to ‘WHM > Tweak Settings > Stats and Logs’. The value of ‘The interval, in days, to retain Exim stats in the database’ is the frequency of clearing out eximstats database. Default value is 30 days. For example, if you set it to 2 days, eximstats will be cleared every two days.
Alternatively, if you prefer to do this from command line, then edit /var/cpanel/cpanel.config and set value of exim_retention_days to the number of days to keep eximstats.
How to empty eximstats database
Eximstats database has four tables named defers, failures, sends and smtp. Use DELETE SQL query to delete all rows from these tables. Following is an example of emptying the tables from MySQL monitor command line client:
mysql> use eximstats; Database changed mysql> delete from defers; Query OK, 9778 rows affected (0.01 sec) mysql> delete from failures; Query OK, 110307 rows affected (0.20 sec) mysql> delete from sends; Query OK, 191466 rows affected (0.07 sec) mysql> delete from smtp; Query OK, 93462 rows affected (0.16 sec)
Another way to empty eximstats database is to remove it and create afresh with empty tables. The SQL file /usr/local/cpanel/etc/eximstats_db.sql contains structure of eximstats tables. So remove the database eximstats, create it again and create empty tables using eximstats_db.sql. Commands are given below:
mysqladmin drop eximstats mysqladmin create eximstats mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql
If you want to disable eximstats completely, read the article Disabling eximstats database on cPanel.