HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Installation/Configuration (
-   -   postfix - MySQL connection problem (

epo 13th March 2006 23:52

postfix - MySQL connection problem
Hello y'all,

I'm having some trouble getting postfix to work with mysql. I started out
using the tutorial at
To test the MySQL connection I tried:
postmap -v -q "test" mysql:/etc/postfix/
postmap: cfg_get_str: /etc/postfix/ user = postfix
postmap: cfg_get_str: /etc/postfix/ password = xxx
postmap: cfg_get_str: /etc/postfix/ dbname =
postmap: cfg_get_str: /etc/postfix/ table =
postmap: cfg_get_str: /etc/postfix/
select_field = destination
postmap: cfg_get_str: /etc/postfix/ where_field
= source
postmap: cfg_get_str: /etc/postfix/
additional_conditions =
postmap: cfg_get_str: /etc/postfix/ hosts =
postmap: mysqlname_parse: /etc/postfix/ adding
host '' to list of mysql server hosts
postmap: dict_open: mysql:/etc/postfix/
postmap: dict_mysql_lookup using sql query: select destination from
forwardings where source = 'test'
postmap: dict_mysql_get_active: attempting to connect to host
postmap: warning: connect to mysql server Lost connection to
MySQL server during query

I've switched on logging on my mysql server, but no relevant logs show up.
I was surprised that postmap indicates a connection has been made (although
lost shortly after), but mysql doesn't seem to have recieved (or logged)
this attempt.

I'm running Debian
Software packages:
mysql-server 4.0.24-10sarge1
postfix 2.1.5-9

Anyone interested in solving this one? It would shurely make my day!


falko 14th March 2006 00:10

Please post the output of

netstat -tap

epo 14th March 2006 00:27

Thans for the quick reply.

# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 localhost.localdo:mysql *:* LISTEN 1618/mysqld
tcp 0 0 *:smtp *:* LISTEN 2250/master
tcp6 0 0 *:imaps *:* LISTEN 1559/couriertcpd
tcp6 0 0 *:imap2 *:* LISTEN 1524/couriertcpd
tcp6 0 0 *:ssh *:* LISTEN 1761/sshd
tcp6 0 0 *:smtp *:* LISTEN 2250/master

The mysql server is listening to the correct port, but I just noticed I can't telnet to it:
# telnet 3306
Connected to
Escape character is '^]'.
Connection closed by foreign host.

Is there some mysql configuration I've missed?


falko 14th March 2006 01:01

What's in /etc/hosts and /etc/mysql/my.cnf?

epo 14th March 2006 01:11

It looks like I had a misconfiguration in my hosts.allow settings.
Adding an entry for mysql solved the problem:

Thanks for your clue to pinpoint the problem.

b_52globemaster 3rd August 2006 18:28

i have nearly the same problem

in the logs :

Aug 3 15:24:49 mail postfix/trivial-rewrite[6684]: fatal: mysql:/etc/postfix/,100): table lookup problem
Aug 3 15:25:50 mail postfix/trivial-rewrite[6690]: fatal: mysql:/etc/postfix/,100): table lookup problem

i put

in my /etc/hosts.allow

but the problem still here .

thanks in advance

falko 4th August 2006 14:18

What's in /etc/postfix/

b_52globemaster 4th August 2006 21:49

thanks falko

finally the problem is resolved , and as you suspect it was a grammar syntax error in the sql query in

and thanks

All times are GMT +2. The time now is 11:31.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.