Can't connect to MySQL server on '127.0.0.1' + Postfix
- by Andrew Dakin
I just installed Postfix and configured it to use MySQL. It wasn't sending any emails out after I did that so I checked /var/log/mail.log and it came back with this:
postfix/trivial-rewrite[5283]: fatal: proxy:mysql:/etc/postfix/mysql-domains.cf(0,lock|fold_fix): table lookup problem
postfix/cleanup[5258]: warning: AFCDC30437: virtual_alias_maps map lookup problem for [email protected]
postfix/master[4761]: warning: process /usr/lib/postfix/trivial-rewrite pid 5282 exit status 1
postfix/proxymap[4126]: warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (110)
In mysql-domains.cf I'm using:
Hosts 127.0.0.1
I can connect to MySQL with this:
mysql -u postfixuser -p
But I can't connect this way:
mysql -u postfixuser -h 127.0.0.1 -p maildbname
Also when I run netstat -l it comes back with:
tcp 0 0 localhost:mysql *:* LISTEN
I've tried changing my hosts to:
Hosts localhost
But then I just get a socket error:
postfix/cleanup[4870]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
I also have this set up in the MySQL config file:
bind-address = 127.0.0.1
I'm sure I'm missing something obvious, but I am pretty new to all this.
Thanks!
Andy