Connect failed to database

Dan LaSota dlasota at alaska.edu
Mon Mar 2 05:03:20 UTC 2015


I have dovecot version 2.2.10
dovecot -n output below

I am seeing connection errors being written to my dovecot error log:
Mar  1 19:51:15 mail dovecot: auth-worker(2224): Error: mysql(localhost): Connect failed to database (servermail): Access denied for user 'usermail'@'localhost' (using password: YES) - waiting for 5 seconds before retry

My connection script located at /etc/dovecot/dovecot-sql.conf.ext is like (password edited):

driver = mysql
connect = host=localhost dbname=servermail user='usermail' password='MY_SUPER_SECRET_PASSWORD'
default_pass_scheme = SHA512-CRYPT
password_query = SELECT email as user, password FROM virtual_users WHERE email='%u';

I have verified that I can gain access to the SQL database with
# mysql -u usermail -p

I can make select statements on the 'servermail' database and all of its tables.

I've searched for similar errors from users, but most of the questions are unanswered, or answered incorrectly.
I did follow one thread's suggest of setting the MYSQL password for the 'usermail' with OLD_PASSWORD instead of PASSWORD. I did that. I could still login from the shell using 
mysql -u usermail -p

But dovecot still wrote the same error. (I did a flush privileges, and restarted mysql, and dovecot)
I then set the password in SQL back using PASSWORD. (flush'd priveleges and restarte mysql and dovecot). Still Errors.

Looking for leads.

Thanks,


Dan LaSota
Instructional Designer, UAF eLearning
(907) 451-4067
dan.lasota at alaska.edu
http://elearning.uaf.edu


dovecot -n

# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-123.20.1.el7.x86_64 x86_64 CentOS Linux release 7.0.1406 (Core)  xfs
auth_debug = yes
auth_mechanisms = plain login
auth_verbose = yes
auth_verbose_passwords = plain
mail_debug = yes
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_privileged_group = mail
mbox_write_locks = fcntl
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix = 
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocols = imap lmtp
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    mode = 0600
    user = vmail
  }
  user = dovecot
}
service imap-login {
  inet_listener imap {
    port = 0
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
ssl = required
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
userdb {
  args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
  driver = static
}
verbose_ssl = yes




More information about the dovecot mailing list