How to make dovecot access a MySQL database with a certain domain?

Spike98 spike98 at protonmail.com
Tue Nov 28 20:08:12 EET 2017


I am trying to make a mail server with Postfix using the Dovecot software. At the time of wanting to access my server from a mail client, it does not let me access and see the logs of my server with the command:

    $ service dovecot status
with the following error:

    dovecot: auth-worker(2769): Error: mysql(127.0.0.1): Connect failed to database (postfix): Access denied for user 'postfix'@'localhost' (using password: YES) - waiting for 125 seconds before retry

From what I understand of this error is that it is trying to enter 'postfix' @ 'localhost' instead of the domain that I specify when I made the database that is mydomain.com

How can you make dovecot go to MySQL with postfix at mydomain.com instead of localhost

This is my Dovecot configuration

/etc/dovecot/dovecot-sql.conf.ext

    driver=mysql

    default_pass_scheme=PLAIN-MD5

    connect=host=127.0.0.1 dbname=postfix user=postfix password=postfix

    password_query=SELECT username,domain,password FROM usuarios WHERE username='%n' AND domain='%d'

    user_query=SELECT 1007 as uid, 1007 as gid, concat("maildir:/var/vmail",domain,'/',username,'/') as mail FROM usuarios WHERE username='%n' AND domain='%d'

    iterate_query=SELECT username,domain FROM usuarios


More information about the dovecot mailing list