diff -ur postfix-2.1.5.orig/src/global/dict_mysql.c postfix-2.1.5/src/global/dict_mysql.c
--- postfix-2.1.5.orig/src/global/dict_mysql.c	2004-04-01 07:30:05.000000000 +0900
+++ postfix-2.1.5/src/global/dict_mysql.c	2005-05-17 21:05:31.207805081 +0900
@@ -157,6 +157,8 @@
 
 typedef struct {
     CFG_PARSER *parser;
+    char   *default_file;
+    char   *default_group;
     char   *username;
     char   *password;
     char   *dbname;
@@ -187,11 +189,11 @@
 
 /* internal function declarations */
 static PLMYSQL *plmysql_init(char *hostnames[], int);
-static MYSQL_RES *plmysql_query(PLMYSQL *, const char *, char *, char *, char *);
+static MYSQL_RES *plmysql_query(PLMYSQL *, const char *, char *, char *, char *, char *, char *);
 static void plmysql_dealloc(PLMYSQL *);
 static void plmysql_close_host(HOST *);
 static void plmysql_down_host(HOST *);
-static void plmysql_connect_single(HOST *, char *, char *, char *);
+static void plmysql_connect_single(HOST *, char *, char *, char *, char *, char *);
 static const char *dict_mysql_lookup(DICT *, const char *);
 DICT   *dict_mysql_open(const char *, int, int);
 static void dict_mysql_close(DICT *);
@@ -240,7 +242,9 @@
 				   vstring_str(query),
 				   dict_mysql->name->dbname,
 				   dict_mysql->name->username,
-				   dict_mysql->name->password)) == 0) {
+				   dict_mysql->name->password,
+				   dict_mysql->name->default_file,
+				   dict_mysql->name->default_group)) == 0) {
 	dict_errno = DICT_ERR_RETRY;
 	vstring_free(query);
 	return 0;
@@ -329,7 +333,8 @@
 /* dict_mysql_get_active - get an active connection */
 
 static HOST *dict_mysql_get_active(PLMYSQL *PLDB, char *dbname,
-				   char *username, char *password)
+				   char *username, char *password,
+				   char *default_file, char *default_group)
 {
     const char *myname = "dict_mysql_get_active";
     HOST   *host;
@@ -357,7 +362,7 @@
 	if (msg_verbose)
 	    msg_info("%s: attempting to connect to host %s", myname,
 		     host->hostname);
-	plmysql_connect_single(host, dbname, username, password);
+	plmysql_connect_single(host, dbname, username, password, default_file, default_group);
 	if (host->stat == STATACTIVE)
 	    return host;
     }
@@ -387,12 +392,14 @@
 				        const char *query,
 				        char *dbname,
 				        char *username,
-				        char *password)
+				        char *password,
+				        char *default_file,
+				        char *default_group)
 {
     HOST   *host;
     MYSQL_RES *res = 0;
 
-    while ((host = dict_mysql_get_active(PLDB, dbname, username, password)) != NULL) {
+    while ((host = dict_mysql_get_active(PLDB, dbname, username, password, default_file, default_group)) != NULL) {
 	if (!(mysql_query(host->db, query))) {
 	    if ((res = mysql_store_result(host->db)) == 0) {
 		msg_warn("mysql query failed: %s", mysql_error(host->db));
@@ -417,10 +424,14 @@
  * used to reconnect to a single database when one is down or none is
  * connected yet. Log all errors and set the stat field of host accordingly
  */
-static void plmysql_connect_single(HOST *host, char *dbname, char *username, char *password)
+static void plmysql_connect_single(HOST *host, char *dbname, char *username, char *password, char *default_file, char *default_group)
 {
     if ((host->db = mysql_init(NULL)) == NULL)
 	msg_fatal("dict_mysql: insufficient memory");
+    if (default_file && *default_file)
+	mysql_options(host->db, MYSQL_READ_DEFAULT_FILE, default_file);
+    if (default_group && *default_group)
+	mysql_options(host->db, MYSQL_READ_DEFAULT_GROUP, default_group);
     if (mysql_real_connect(host->db,
 			   (host->type == TYPEINET ? host->name : 0),
 			   username,
@@ -503,14 +514,17 @@
     /* parser */
     name->parser = cfg_parser_alloc(mysqlcf);
 
+    name->default_file = cfg_get_str(name->parser, "default_file", "", 0, 0);
+    name->default_group = cfg_get_str(name->parser, "default_group", "", 0, 0);
+
     /* username */
     name->username = cfg_get_str(name->parser, "user", "", 0, 0);
 
     /* password */
-    name->password = cfg_get_str(name->parser, "password", "", 0, 0);
+    name->password = cfg_get_str(name->parser, "password", NULL, 0, 0);
 
     /* database name */
-    name->dbname = cfg_get_str(name->parser, "dbname", "", 1, 0);
+    name->dbname = cfg_get_str(name->parser, "dbname", "", 0, 0);
 
     /* table name */
     name->table = cfg_get_str(name->parser, "table", "", 1, 0);
@@ -630,8 +644,10 @@
 
     plmysql_dealloc(dict_mysql->pldb);
     cfg_parser_free(dict_mysql->name->parser);
+    myfree(dict_mysql->name->default_file);
+    myfree(dict_mysql->name->default_group);
     myfree(dict_mysql->name->username);
-    myfree(dict_mysql->name->password);
+    if (dict_mysql->name->password) myfree(dict_mysql->name->password);
     myfree(dict_mysql->name->dbname);
     myfree(dict_mysql->name->table);
     myfree(dict_mysql->name->select_field);
