[Dovecot] mysql authentication problems
Hello all..
I'm trying to configure dovecot do athenticate using mysql, but I?m having some troubles... After configuring the mysql athentication in dovecot-mysql.conf and in dovecot.conf, when I try to login I get this mesage in my logs:
Dovecot-auth: MySQL: Can't connect to database dovecot: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2)
Any ideia why this happens and how to fix it?
Thanks in advance,
Pedro
That means that mysqld is not running or dovecot is looking in the
wrong place for it. Can you get to mysql from the command line? If
so, you'll need to figure out where mysql.sock is located (look in /
etc/my.cnf) and then point dovecot to it. If you can't run mysql
from the command line then the daemon is not running and you will
need to start it.
- Jon
On Apr 26, 2006, at 4:01 PM, Pedro Vieira wrote:
Hello all..
I'm trying to configure dovecot do athenticate using mysql, but I?m
having some troubles... After configuring the mysql athentication in dovecot-mysql.conf and
in dovecot.conf, when I try to login I get this mesage in my logs:Dovecot-auth: MySQL: Can't connect to database dovecot: Can't
connect to local MySQL server through socket '/var/tmp/mysql.sock' (2)Any ideia why this happens and how to fix it?
Thanks in advance,
Pedro
Hi,
If you are on Debian Sarge with dovecot 0.99.14, example in configuration file dovecot-mysql.conf indeed points to /var/tmp/mysql.sock db_unix_socket = /var/tmp/mysql.sock
But on Debian MySQL socket is created as /var/run/mysqld/mysqld.sock
I suppose you can change to: db_unix_socket = /var/run/mysqld/mysqld.sock or
use TCP connection to MySQL instead of socket: db_host = localhost db_port = 3306
I hope this helps.
Regards, Dumitru
Jon Baker wrote:
That means that mysqld is not running or dovecot is looking in the wrong place for it. Can you get to mysql from the command line? If so, you'll need to figure out where mysql.sock is located (look in /etc/my.cnf) and then point dovecot to it. If you can't run mysql from the command line then the daemon is not running and you will need to start it.
- Jon
On Apr 26, 2006, at 4:01 PM, Pedro Vieira wrote:
Hello all..
I'm trying to configure dovecot do athenticate using mysql, but I?m having some troubles...
After configuring the mysql athentication in dovecot-mysql.conf and in dovecot.conf, when I try to login I get this mesage in my logs:
Dovecot-auth: MySQL: Can't connect to database dovecot: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2)
Any ideia why this happens and how to fix it?
Thanks in advance,
Pedro
Hi,
Thanks for your reply :)
Yes, I'm susing both Debian and dovecot 0.99.14
I tried to connect using tcp and the authentication stills fails. With the db_unix_socket line comented I still get this error on my mail logfile
dovecot-auth: MySQL: Can't connect to database dovecot: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock'
I checked /etc/mysql/my.cnf and the path is correct: /var/run/mysqld/mysqld.sock.
Any ideias? :(
Thanks,
Pedro
Dumitru Negara wrote:
Hi,
If you are on Debian Sarge with dovecot 0.99.14, example in configuration file dovecot-mysql.conf indeed points to /var/tmp/mysql.sock db_unix_socket = /var/tmp/mysql.sock
But on Debian MySQL socket is created as /var/run/mysqld/mysqld.sock
I suppose you can change to: db_unix_socket = /var/run/mysqld/mysqld.sock or
use TCP connection to MySQL instead of socket: db_host = localhost db_port = 3306
I hope this helps.
Regards, Dumitru
Jon Baker wrote:
That means that mysqld is not running or dovecot is looking in the wrong place for it. Can you get to mysql from the command line? If so, you'll need to figure out where mysql.sock is located (look in /etc/my.cnf) and then point dovecot to it. If you can't run mysql from the command line then the daemon is not running and you will need to start it.
- Jon
On Apr 26, 2006, at 4:01 PM, Pedro Vieira wrote:
Hello all..
I'm trying to configure dovecot do athenticate using mysql, but I?m having some troubles...
After configuring the mysql athentication in dovecot-mysql.conf and in dovecot.conf, when I try to login I get this mesage in my logs:
Dovecot-auth: MySQL: Can't connect to database dovecot: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2)
Any ideia why this happens and how to fix it?
Thanks in advance,
Pedro
You need to change the db_unix_socket line to reference /var/run/
mysqld/mysqld.sock in your dovecot mysql conf file, not just comment
it out. Be sure to restart dovecot when you make the change as well.
On Apr 27, 2006, at 9:07 AM, Pedro Vieira wrote:
Hi,
Thanks for your reply :)
Yes, I'm susing both Debian and dovecot 0.99.14
I tried to connect using tcp and the authentication stills fails. With the db_unix_socket line comented I still get this error on my
mail logfiledovecot-auth: MySQL: Can't connect to database dovecot: Can't
connect to local MySQL server through socket '/var/tmp/mysql.sock'I checked /etc/mysql/my.cnf and the path is correct: /var/run/ mysqld/mysqld.sock.
Any ideias? :(
Thanks,
Pedro
But I did it, and I still get the same error... :(
where goes my dovecot-mysql.conf:
################################### db_host = localhost db_port = 3306 #db_unix_socket = /var/run/mysqld/mysql.sock db = mydovecotdb db_user = mydovecotuser db_passwd = mydbpasswd db_client_flags = 0
default_pass_scheme = PLAIN password_query = SELECT password FROM users WHERE userid = '%u' user_query = SELECT home, uid, gid FROM users WHERE userid = '%u'
######################################
Jon Baker wrote:
You need to change the db_unix_socket line to reference /var/run/mysqld/mysqld.sock in your dovecot mysql conf file, not just comment it out. Be sure to restart dovecot when you make the change as well.
On Apr 27, 2006, at 9:07 AM, Pedro Vieira wrote:
Hi,
Thanks for your reply :)
Yes, I'm susing both Debian and dovecot 0.99.14
I tried to connect using tcp and the authentication stills fails. With the db_unix_socket line comented I still get this error on my mail logfile
dovecot-auth: MySQL: Can't connect to database dovecot: Can't connect to local MySQL server through socket '/var/tmp/mysql.sock'
I checked /etc/mysql/my.cnf and the path is correct: /var/run/mysqld/mysqld.sock.
Any ideias? :(
Thanks,
Pedro
Already did it... now i have this error:
dovecot-auth: MySQL: Can't connect to database dovecot: Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
I already have smoke comming out of my head.... :S
Jon Baker wrote:
Um... uncomment your socket line perhaps?
On Apr 27, 2006, at 5:46 PM, Pedro Vieira wrote:
db_host = localhost db_port = 3306 #db_unix_socket = /var/run/mysqld/mysql.sock db = mydovecotdb db_user = mydovecotuser db_passwd = mydbpasswd db_client_flags = 0
This settings worked for me:
dovecot.conf
protocols = imap imaps pop3 pop3s ssl_cert_file = /etc/dovecot/tls/dovecot.cert ssl_key_file = /etc/dovecot/tls/dovecot.key login = imap login = pop3 first_valid_uid = 111 #id of user vmail mail_extra_groups = mail default_mail_env = maildir:/space/vmail/%d/%n auth = default auth_mechanisms = plain auth_userdb = mysql /etc/dovecot/dovecot-mysql.conf auth_passdb = mysql /etc/dovecot/dovecot-mysql.conf auth_user = root
dovecot-mysql.conf
db_host = 127.0.0.1 db_port = 3306 db = postfix db_user = dbuser db_passwd = dbpass db_client_flags = 0 default_pass_scheme = PLAIN password_query = SELECT password FROM mailbox WHERE username = '%u' user_query = SELECT maildir, 111 AS uid, 106 AS gid FROM mailbox WHERE username = '%u' #106 - id of group postfix
I followed this howto http://bliki.rimuhosting.com/space/knowledgebase/linux/mail/postfixadmin+on+...
Regards, Dumitru
Pedro Vieira wrote:
Already did it... now i have this error:
dovecot-auth: MySQL: Can't connect to database dovecot: Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
I already have smoke comming out of my head.... :S
Jon Baker wrote:
Um... uncomment your socket line perhaps?
On Apr 27, 2006, at 5:46 PM, Pedro Vieira wrote:
db_host = localhost db_port = 3306 #db_unix_socket = /var/run/mysqld/mysql.sock db = mydovecotdb db_user = mydovecotuser db_passwd = mydbpasswd db_client_flags = 0
Pedro Vieira wrote:
Already did it... now i have this error:
dovecot-auth: MySQL: Can't connect to database dovecot: Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
What does the ls -al /var/run/mysqld/mysql.sock; ls -ald /var/run/mysqld/
say?
HTH, -jkt
-- cd /local/pub && more beer > /dev/mouth
It should be TCP:
db_host = localhost db_port = 3306 #db_unix_socket = /var/run/mysqld/mysqld.sock
or socket
#db_host = localhost #db_port = 3306 db_unix_socket = /var/run/mysqld/mysqld.sock
Not both.
And socket is */var/run/mysqld/mysqld.sock*, not /var/run/mysqld/mysql.sock
Regards, Dumitru
Pedro Vieira wrote:
Already did it... now i have this error:
dovecot-auth: MySQL: Can't connect to database dovecot: Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
I already have smoke comming out of my head.... :S
Jon Baker wrote:
Um... uncomment your socket line perhaps?
On Apr 27, 2006, at 5:46 PM, Pedro Vieira wrote:
db_host = localhost db_port = 3306 #db_unix_socket = /var/run/mysqld/mysql.sock db = mydovecotdb db_user = mydovecotuser db_passwd = mydbpasswd db_client_flags = 0
participants (4)
-
Dumitru Negara
-
Jan Kundrát
-
Jon Baker
-
Pedro Vieira