dovecot无法执行mysql查询

我一直在关注workaround.org上的ISPMail教程(2.9 Wheezy版本),到目前为止一切工作正常。 当我到达“testing电子邮件传送”步骤时,我注意到关于来自/var/log/mail.log的输出日志中的查询错误。

May 14 06:48:59 mail postfix/pickup[17704]: EA4AD240A98: uid=0 from=<root> May 14 06:48:59 mail postfix/cleanup[17776]: EA4AD240A98: message-id=<[email protected]> May 14 06:48:59 mail postfix/qmgr[17706]: EA4AD240A98: from=<[email protected]>, size=429, nrcpt=1 (queue active) May 14 06:49:00 mail dovecot: auth-worker(17782): mysql(127.0.0.1): Connected to database mailserver May 14 06:49:00 mail dovecot: auth-worker(17782): Warning: mysql: Query failed, retrying: Table 'mailserver.users' doesn't exist May 14 06:49:00 mail dovecot: auth-worker(17782): Error: sql([email protected]): User query failed: Table 'mailserver.users' doesn't exist (using built-in default user_query: SELECT home, uid, gid FROM users WHERE username = '%n' AND domain = '%d') May 14 06:49:00 mail dovecot: lda([email protected]): msgid=<[email protected]>: saved mail to INBOX May 14 06:49:00 mail postfix/pipe[17780]: EA4AD240A98: to=<[email protected]>, relay=dovecot, delay=0.09, delays=0.03/0.01/0/0.06, dsn=2.0.0, status=sent (delivered via dovecot service) May 14 06:49:00 mail postfix/qmgr[17706]: EA4AD240A98: removed 

我发现这很有趣,它没有find数据库,所以我回去了,检查了我涉及的数据库(包括后缀cf文件)的每一个文件,一切都是正确的,所以我很困惑,在这一点上,但奇怪看起来电子邮件仍然在/var/vmail/domain.com/中find正确的目的地。

我应该担心这个还是我在这里错过了什么? 由于它是来自dovecot的消息,它将是我在这里包括的dovecot-sql.conf.ext的查询

 driver = mysql connect = host=127.0.0.1 dbname=mailserver user=blocked password=***REMOVED*** default_pass_scheme = PLAIN-MD5 password_query = SELECT email as user, password FROM virtual_users WHERE email='%u'; 

正如它在你的mail.log中所说的,user_query的值没有被定义。 这就是为什么Dovecot正在回落到默认查询。

打开configuration文件/etc/dovecot/dovecot-sql.conf.ext,user_query的值很可能会被注释掉或为空。 填写一个适当的查询。

就像我一样,如果你对所有的邮件帐户使用相同的UID和GID(比如5000),你可以做一些简单的事情

 user_query = SELECT ('5000') as 'uid',('5000') as 'gid' 

只是我在你的configuration文件中注意到的另一件事。 最好避免使用PLAIN-MD5作为你的default_pass_scheme。 更好地切换到像SHA512更强大的东西。

希望你find我的答案有帮助。 干杯!

Dovecot正在寻找一个名为users的表,而您似乎在virtual_users表中有数据:

 Query failed, retrying: Table 'mailserver.users' doesn't exist 

重命名该表或将dovecotconfiguration为使用virtual_users表。