Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
This question was answered by @Azendale:
I had a similar error message, and found I had the wrong database set in the mysql-mailbox-domains.cf file. Make sure you are using the right database name.
Second, using 127.0.0.1 instead of localhost is the right direction here: MySQL treats the name ‘localhost’ specially and tries to use a socket to connect. On my server, this caused problems because the postfix daemon is chrooted and couldn’t access that socket. 127.0.0.1 makes the mysql client library used by postfix properly use the network stack to get to the MySQL server.
Also, I found an error that virtual domains shouldn’t be listed in the database and mydestination: postfix/trivial-rewrite[18739]: warning: do not list domain <domain.tld> in BOTH mydestination and virtual_mailbox_domains
I found that removing the domain from mydestination fixed that.
Hopefully that helps. I seem to have a working configuration. I built it from scratch a few years ago, but it is very similar in that it is using MySQL for the virtual domains & mailboxes & aliases. Hopefully what I’ve found helps. If not, maybe I can do more looking through my working config to help you out. (This is running on a Ubuntu 14.04 LTS trusty server the the moment.)
Brent’s command was very helpful in debugging this: it should return the result of trying to lookup the -q value using the mapping specified by the provided file.