While installing a new mail server i ran into a problem with SMTP authentication. The mail server in question is postfix installed on a Debian lenny box. The backend for postfix is MySQL. And because SASL is always a pain to configure i used dovecot to do the SMTP authentication with the MySQL backend. This however resulted in the following error
Jun 21 17:43:02 ims1 dovecot: auth-worker(default): mysql: Connect failed to localhost (mail): Access denied for user ‘mail_admin’@'localhost’ (using password: YES) – waiting for 1 seconds before retry
It took me a while to figure this out. The settings in ‘dovecot-sql.conf’ were correct. Logging in with the same data from a shell went without a problem. I remembered i had this problem some years ago. With a vpopmail setup. The problem then was the encryption algorithm used by MySQL. So i tried to use the older encryption algorithm.
SET PASSWORD FOR ‘user’@'localhost’ = OLD_PASSWORD(‘password’);
After a restart everything was fine.
Jun 21 18:41:03 ims1 dovecot: auth-worker(default): mysql: Connected to localhost (mail)
Like i said it took me a while to figure out. So maybe i can safe somebody some time.



Twitter
I am Thijs Lensselink a Webdeveloper from the Netherlands.
on this site (http://wiki.dovecot.org/MysqlProblems) i readed that mysqld above 5.0.19 and dovecot above 1.0rc9 not affected with this problem. i have installed mysql-server-5.0.83 and dovecot-1.1.16. And even doesn’t work, when i’m hashing the password with OLD_PASSWORD().. do you have any idea?
Well i actually got fed-up trying to configure dovecot with postfix. So i switched back to postfix and saslauthd for the authentication.
Will have a look at this though. I’m still looking for a better setup then i have now.
Thanks, man. It works like a charm.