Using MySQL for the SpamAssassin bayes database
Storing the bayes database in a MySQL table might be practical, if you have separate spamassassin services on two servers. This makes sure that the bayes_db is intact and similar for both machines.
- Create a MySQL database on your MySQL server - or use a preexisting one. The former can be done via the MySQL terminal:
> create database spam_bayes;
- set the right privileges:
> grant all privileges on spam_bayes.* to 'spamuser'@'localhost' identified by 'dbpassword';
- replace 'spamuser' with your preferred DB user, and 'dbpassword' with your preferred DB password.
- download the sql table file from: http://kb.atmail.com/attach/bayes_mysql.sql
- create the SQL tables:
% mysql -u spamuser -p spam_bayes < bayes_mysql.sql
- add the following to your /usr/local/atmail/spamassassin/local.cf file:
bayes_store_module Mail::SpamAssassin::BayesStore::MySQL bayes_sql_dsn DBI:mysql:spam_bayes:localhost bayes_sql_username spamuser bayes_sql_password dbpassword
- replace the spam_bayes, localhost, spamuser and dbpassword fields with the values you picked prior.- restart @Mail:
% /etc/init.d/atmailserver restart

