Skip to content

Postfix mySQL Error 451 4.3.0 Temporary lookup failure

This problem caused me quite a bit of grief, nearly a whole day of tweaking and learning and finally I figured it out.

The problem was a password mismatch. I guess I had a weird character in my mySQL password, that I didn’t have in my query string.

A little more background.

I’ve been configuring a postfix mail engine with a mySQL database, using table lookups and virtual hosts. (Note: if you’re looking for a great tutorial, you can find one at

According that that tutorial, I had set up everything as it asked, so I went to test the configuration using a telnet session through my SSH interface Putty.

It would consistently allow me to start my  give me the error very similar to:

telnet localhost 25
Connected to localhost.220 my.domain ESMTP Postfix (Ubuntu)
EHLO my.domain

250 2.1.0 Ok
RCPT TO: root
451 4.3.0 <root>: Temporary lookup failure
221 2.0.0 Bye

It should be clear the 451 4.3.0 Temporary lookup failure was not a good thing.

Looking at my mail.log files, I should have clued in earlier since it was saying:

warning: mysql:/etc/postfix/ lookup error for “root@my.domain”
warning: virtual_alias_maps map lookup problem for root@my.domain — deferring delivery

What I kept doing was looking at the file and double checking all of the configurations, making sure it all worked.

What I should have done was immediately try using postmap. To use this, I tested with the following query:

sudo postmap -q <domain I have added to my mailboxes file (any domain will return something really)> mysql:/etc/postfix/

What this basically does is use the handy postmap program, which can be used to quickly test your postfix installation, to query mySQL using the configuration file, and the query string supplied.

This returned:

postmap: warning: connect to mysql server Access denied for user ‘<user>’@’localhost’ (using password: YES)
postmap: fatal: table mysql:/etc/postfix/ query error: Success

Well, obviously it was trying to send the query, but the mySQL db wasn’t letting it get in!

A quick test now connecting to the database:

mysql -u <user> -p

And entering the password when prompted that I was using returned another Access denied for user.

So, as stated at the start, the problem was simply solved by re-entering the password used for the user I was trying to access the database with. After doing this, the quick connect to database test mysql -u <user> -p allowed me access, and everybody is happy!

Hope this helps!

I referenced’s Postfix Configuration page for help using the postmap query.

I also referenced Postfix’s manual for table 5, relating to the mySQL query configuration file.


3 thoughts on “Postfix mySQL Error 451 4.3.0 Temporary lookup failure”

Leave a Reply

Your email address will not be published. Required fields are marked *

19 − eight =