This is not correct for sasl-2.1.x. You should use either auxprop or
saslauthd there. Since "pam" is wrong, sasl is likely using the default
(auxprop), hence the error messages about not being able to open the
db (which I assume is /etc/sasldb2).

> What I wanted to do is
> /usr/sbin/saslauthd -a pam
> but this gives the error message
> unknown authentication mechanism: pam

Then saslauthd is not compiled with pam support. Try shadow just for the
sake of testing, it would use /etc/shadow.