[Dovecot] Problem with MySQL
Hi there, I tried to setup a passwddb with mysql, but it wont connect to my database, even if I patch the driver-mysql.c
Here a test program I wrote to check the connection: int main() { MYSQL mysql; mysql_init(&mysql); if (mysql_real_connect(&mysql, NULL, "root", "asd2sdf3", "ccc", 0, "/var/lib/mysql/mysql.sock", 0) == NULL) printf("connection failed: %s\n", mysql_error(&mysql)); else printf("nos problemos\n"); return 0; }
This program executed says "nos problemos" --> connection works The same data in dovecot.conf brings up this: Sep 15 03:08:38 suse10064lamp dovecot: auth-worker(default): ok... connecting to mysql: host='(null)', user='root', pass='asd2sdf3', db='ccc', port='0', sock='/var/lib/mysql/mysql.sock' Sep 15 03:08:38 suse10064lamp dovecot: auth-worker(default): mysql: Connect failed to /var/lib/mysql/mysql.sock (ccc): Access denied for user 'root'@'localhost' (using password: YES) - waiting for 1 seconds before retry
I added a i_info() in front of the mysql_real_connect command to test if the data from the config file is transmitted correctly (first line above) --> it is
So i tried to connect to mysql with the line from my test-program. this is the patched code: i_info("ok... connecting to mysql: host='%s', user='%s', pass='%s', db='%s', port='%i', sock='%s'", host, db->user, db->password, db->dbname, db->port, unix_socket); /* failed = mysql_real_connect(conn->mysql, host, db->user, db->password, db->dbname, db->port, unix_socket, db->client_flags) == NULL; */ failed = mysql_real_connect(conn->mysql, NULL, "root", "asd2sdf3", "ccc", 0, "/var/lib/mysql/mysql.sock", 0) == NULL;
And it still says: Sep 15 03:08:38 suse10064lamp dovecot: auth-worker(default): ok... connecting to mysql: host='(null)', user='root', pass='asd2sdf3', db='ccc', port='0', sock='/var/lib/mysql/mysql.sock' Sep 15 03:08:38 suse10064lamp dovecot: auth-worker(default): mysql: Connect failed to /var/lib/mysql/mysql.sock (ccc): Access denied for user 'root'@'localhost' (using password: YES) - waiting for 1 seconds before retry
Any ideas? Thx in advance, Emmeran
Quoting Emmeran Sollner:
Sep 15 03:08:38 suse10064lamp dovecot: auth-worker(default): mysql: Connect failed to /var/lib/mysql/mysql.sock (ccc): Access denied for user 'root'@'localhost' (using password: YES) - waiting for 1 seconds before retry
http://wiki.dovecot.org/MysqlProblems, 2nd paragraph.
The question remains, why this happens at all. When linked to current libs, this should really work (like your test program does). Maybe again some symbol name conflict. I think this should be fixed before releasing 1.0, otherwise it will hit a lot of people.
participants (2)
-
Emmeran Sollner
-
Jakob Hirsch