Postfix "Can't connect to MySQL server"

started at 11 May 2010 by Fred Turner
  • Fred Turner
    11 May 2010

    Had everything pretty close to running, aside from the "createmaildir" script not working, but after a reboot of the server, I get this over and over in the logs:

    postfix/trivial-rewrite[809]: warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (61)
    postfix/trivial-rewrite[809]: fatal: mysql:/etc/postfix/mysql_virtual_alias_maps.cf(0,lock|fold_fix): table lookup problem
    postfix/smtpd[479]: warning: problem talking to service rewrite: Unknown error: 0
    postfix/master[31]: warning: process /usr/libexec/postfix/trivial-rewrite pid 809 exit status 1
    postfix/master[31]: warning: /usr/libexec/postfix/trivial-rewrite: bad command startup -- throttling

    Any idea why it can't connect? I'm assuming that the "table lookup problem" is simply the first mysql lookup that postfix does, and since it is unable to connect, that fails w/ the "lookup problem"...right? I manually ran mysql and connected as user "postfix" w/o issue.

    Thx,
    Fred

  • Richard
    12 May 2010

    I've never seen this error before. I would have to try some stuff to really pinpoint the cause of this. But I'm currently don't have access to a Mac, perhaps later...

  • Fred Turner
    13 May 2010

    Uh oh...if you've never seen this, then I'm probably screwed! If you think of anything I can test or check out, I'm all ears. Seems to me like somehow postfix is unable to access info in the auxiliary virtual files. Dumb question: where are the MySQL-specific logs in our DIY installation?

    Thx,
    FT

    P.S. Is there any way to subscribe to threads here for instant email notification?

  • Richard
    13 May 2010

    They are in /usr/local/mysql/data/ you'll need root access to read them.

    Are the files readable for postfix.

    notifications are not yet possible, I need to upgrade the software of the forum to do that. But don't despair Im working on it...

  • Fred Turner
    04 Jun 2010

    Okay, I must be dense...what do I need to use to view these logs? Tried 'tail' and I got mostly gibberish over the screen!

    Thx,
    Fred

  • Richard
    04 Jun 2010

    Think you need to use something like this: http://dev.mysql.com/doc/refman/5.1/en/myisamlog.html

  • Fred Turner
    07 Jun 2010

    Thanks, Richard, but I don't have the foggiest idea how to use that. I tried running it on "ib_logfile0" and "ib_logfile1", but only got the following output:

    Warning:  is opened with same process and filenumber
    Maybe you should use the -P option ?

    I guess it's a sign you should throw in the towel and do something else when you're not even able to see the logs to tell you what might be going wrong...

  • Fred Turner
    07 Jun 2010

    Can you think of *any* reason why lookups from postfix to mysql would be failing? It seems to me that the critical log entries are:

    postfix/trivial-rewrite[809]: warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (61)
    postfix/trivial-rewrite[809]: fatal: mysql:/etc/postfix/mysql_virtual_alias_maps.cf(0,lock|fold_fix): table lookup problem

    Is it something to do w/ the virtual alias maps file?

  • Fred Turner
    07 Jun 2010

    Okay, seem to be making progress, although I can't say w/ 100% certainty that I know what the fix was. I went into the 3 mysql_virtual files and changed the "hosts" line from:

    hosts = 127.0.0.1

    as the instructions say, to:

    hosts = localhost

    No idea why that would make a difference-- they should be one and the same. However, things seem to work now w/o the error, and mail gets delivered properly. Would still be interested to hear your thoughts.

    Now on to the next problem! :-D

    Thx,
    Fred

Reply

You must log in to post.