How to Clean Eximstats Database
Generally eximstats database looks very small in size when Cpanel is installed. The database is setup by default when Cpanel installation on the server is completed. So what exactly is this database for. As the name suggests “exim stats” its clear that this mysql database generates statistics from exim main log file or syslog file. But there is one issue with this database as over the time the size of this database gets increasing day by day depending on the log file transactions and many times gets crashed. You will notice crash errors being reported in the mysql error log file thus degrading the performance of Mysql server at some extent.
‘./eximstats/failures’ is marked as crashed
The database itself can be repaired, but running the following command but if the database size is too large it will take some amount of time to repair ir.
root@server [/var/lib/mysql]# mysqlcheck --repair eximstats
Well I recommend modifying the following option under the “Stats and Logs” tab in “WHM Home » Server Configuration » Tweak Settings”: “The interval, in days, to retain Exim stats in the database” , You can reduce the number of days if you find there is too much disk space usage being utilized by Eximstats.
To find out how much size the database is using run the following command.
root@server [/var/lib/mysql/eximstats]# du -sh
6GB
Its perfectly safe to truncate this database if the size of database is getting larger and larger, I have written the following ways to clean the eximstats database.
Step 1
Login to mysql by simply running the mysql command on the command prompt.
root@server [/var/lib/mysql]# mysql
mysql> use eximstats
mysql> delete from sends;
mysql> delete from smtp;
mysql> delete from failures;
mysql> delete from defers;
Step 2 the easy way around
root@server [/var/lib/mysql]# mysqladmin drop eximstats
root@server [/var/lib/mysql]# mysqladmin create eximstats
root@server [/var/lib/mysql]# mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql
The last command will re-generate the eximstats database using the sql back file for eximstats database. Hope this helps you.