When trying to run Postfix with virtual maps in MySQL, you can get the following error:
connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' postfix
This error is because postfix is running in chroot /var/spool/postfix. So it cannot find the unix socket for MySQL.
If you have the option to run mysql on 127.0.0.1 or on another IP, simply go to;
/etc/postfix
run;
grep localhost *
and replace all localhost to 127.0.0.1 or the IP in all files starting with mysql-virtual.
If you insist on running via unix sockets, you can simply fix it by running;
mkdir /var/spool/postfix/var
mount –bind /var /var/spool/postfix/var
Ater this, all will work fine.
Be the first to leave a comment. Don’t be shy.