" Access denied for user.. 'dovecot'@'localhost' " 

Is a mysql error. mysql isn't allowing the user dovecot to open the database to 
run your SQL query.  Until you can open the database, you aren't even 
retrieving the account password. That is where you should concentrate your 
efforts. I don't use mysql for authentication so I can't really tell you how to 
configure dovecot or mysql to make it work. 

> -----Original Message-----
> From: Ken Wright via dovecot <dovecot@dovecot.org>
> Sent: Saturday, February 15, 2025 4:41 PM
> To: Aki Tuomi <aki.tu...@open-xchange.com>; Ken Wright via dovecot
> <dovecot@dovecot.org>; Timo Sirainen <t...@sirainen.com>
> Subject: Re: Userdb lookup problems
> 
> On Sat, 2025-02-15 at 20:24 +0200, Aki Tuomi wrote:
> >
> >
> >
> > >
> > > On 15/02/2025 18:29 EET Ken Wright via dovecot
> > > <dovecot@dovecot.org> wrote:
> > >
> > >
> > >
> > >
> > >
> > > On Sat, 2025-02-15 at 17:53 +0200, Aki Tuomi wrote:
> > >
> > > >
> > > > >
> > > > > On 15/02/2025 17:39 EET Ken Wright via dovecot
> > > > >
> > > > > <dovecot@dovecot.org> wrote:
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Sat, 2025-02-15 at 08:59 +0200, Timo Sirainen wrote:
> > > > >
> > > > > >
> > > > > > On 15. Feb 2025, at 0.06, Ken Wright via dovecot
> > > > > >
> > > > > > <dovecot@dovecot.org> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > These need to be converted to the new syntax.
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > > Is this correct?
> > > > >
> > > > >
> > > > >
> > > > > passdb sql {
> > > > >
> > > > >   query = SELECT username AS username, domain, password FROM
> > > > >
> > > > > mailbox
> > > > >
> > > > > WHERE username = '%{user | username}' AND domain = '%{user |
> > > > >
> > > > > domain}'
> > > > >
> > > > > AND active= '1'
> > > > >
> > > > >   }
> > > > >
> > > > > userdb sql {
> > > > >
> > > > >   query = SELECT maildir, 2000 AS uid, 2000 AS gid FROM mailbox
> > > > >
> > > > > WHERE
> > > > >
> > > > > username = '%{user | username}' AND domain = '%{user | domain}'
> > > > > AND
> > > > >
> > > > > active= '1'
> > > > >
> > > > >   # For using doveadm -A:
> > > > >
> > > > >   iterate_query = SELECT username AS username, domain FROM
> > > > > mailbox
> > > > >
> > > > >
> > > > >
> > > >
> > > > Like mentioned already on some thread, returning maildir is not
> > > >
> > > > right, check
> > > >
> > > > https://doc.dovecot.org/2.4.0/core/config/mailbox/mail_location.html
> > > >
> > > >
> > > > and return mail_path instead.
> > > >
> > >
> > > Okay, I changed maildir to mail_path, but I still can't log in.
> > >
> > >
> > >
> > > I'm sorry, but I think I need to see the fix spelled out. I'm an
> > >
> > > idiot.
> > >
> > >
> > >
> > > Ken
> > >
> > >
> > >
> >
> >
> >
> > Did you check logs for details? If there is not much, try
> >
> >
> >
> > log_debug=category=auth
> >
> > mail_debug=yes
> 
> These two lines in /var/log/mail.log seem to be pertinent:
> 
> 2025-02-15T16:33:29.976767-05:00 grace dovecot: auth: Error:
> mysql(localhost): Connect failed to database (): Access denied for user
> 'dovecot'@'localhost' (using password: NO) - waiting for 1 seconds
> before retry
> 2025-02-15T16:33:36.560826-05:00 grace dovecot: imap-login: Login
> aborted: Connection closed (auth failed, 1 attempts in 7 secs)
> (auth_failed): user=<wiz...@koalatyworks.com>, method=PLAIN,
> rip=192.168.1.1, lip=192.168.1.10, TLS, session=<V2HRCjUu2ObAqAEB>
> 
> I don't understand why access is denied.  I don't understand why it
> didn't use the password.  Help!
> 
> Ken
> _______________________________________________
> dovecot mailing list -- dovecot@dovecot.org
> To unsubscribe send an email to dovecot-le...@dovecot.org

_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to