Postfix is throwing up an error saying:
Jul 9 14:41:26 tmail postfix/trivial-rewrite[4342]: warning: connect to mysql server unix:/var/run/mysqld/mysqld.sock: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Jul 9 14:41:26 tmail postfix/trivial-rewrite[4342]: fatal: mysql:/etc/postfix/mysql-yaa-aliases.cf(0,lock|fold_fix): table lookup problem
In main.cf I have:
virtual_alias_maps = mysql:/etc/postfix/mysql-yaa-aliases.cf
In mysql-yaa-aliases.cf I have:
hosts = unix:/var/run/mysqld/mysqld.sock
# hosts = 127.0.0.1
user = yaa_admin
password = ********
dbname = yaa
query = SELECT dest FROM yaa_active_aliases WHERE address='%s'
If I use 127.0.0.1 it works (not ideal as I would prefer the speed of a socket.) Also if I test the socket with postmap it works:
# postmap -q "[email protected]" mysql:/etc/postfix/mysql-yaa-aliases.cf
[email protected], [email protected]
When I use strace on the trivial-rewrite daemon I get:
connect(11, {sa_family=AF_FILE, path="/var/run/mysqld/mysqld.sock"}, 110) = -1 ENOENT (No such file or directory)
Whereas strace using postmap I get:
connect(4, {sa_family=AF_FILE, path="/var/run/mysqld/mysqld.sock"}, 110) = 0
BTW - Currently running Postfix 2.7, but the fault still shows with 2.9