Talk:My SpamAssassin MySQL How-To
From Wistful.net
This is the discussion page for the SA MySQL how-to. Here you can add notes and comments. Please click on the + (plus symbol) next to the edit link along the top of the page so you can add an individual comment instead of editing the entire discussion page.
When pasting code, try to make sure it starts with one or more blank lines (including those lines which otherwise contain no text) so that it is placed in a nice pre-formatted block. If you want to make an ordered list, make your lines start with a # (pound), and use a * (star) for unordered lists. Remember to use the preview function.
[edit] Create the database and user
Hello!
Nowadays - as MySQL evolves - one should make use of the GRANT command:
GRANT SELECT, INSERT, UPDATE, DELETE on spamassassin.* to spamassassin@localhost identified by 'SApassword';
CREATE DATABASE spamassassin;
So one can leave out the "reload".
Bye, Markus Mann
[edit] Improving the 'trim' function.
I suggest that rather than trimming all entries with only 1 hit, this function could be improved a bit. First, add a timestamp field to awl:
ALTER TABLE `awl` ADD `modified` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
Now, when we trim we can see when the entry was added - thereby excluding entries with only one hit that were only recently added to the table. Update our awl-trim.sql to exclude entries added or modified in the last 21 days:
USE spamassassin;
DELETE FROM awl WHERE count="1" AND NOT DATE_SUB(CURDATE(),INTERVAL 21 DAY) <= modified;

