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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Spike98
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

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

Roger Klorese
Replace 127.0.0.1 with the domain name.
On Tue, Nov 28, 2017 at 10:08 AM Spike98 <[hidden email]> wrote:

> 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

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

Tobias-42
In reply to this post by Spike98
The @localhost part is correct if you connecting to mysql at 127.0.0.1. It's the rdns of the connecting client. 
Are you sure that the user postfix has access rights to postfix database? Can you connect on cli using something like
mysql -upostfix -ppostfix postfix 
?


Am 28. November 2017 19:08:12 MEZ schrieb Spike98 <[hidden email]>:

>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 [hidden email] 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

--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.