我使用dovecot + postfix + mysql配置了邮件服务器,并且在服务器(Ubuntu服务器)中运行正常。但是在上周,它停止了正常工作。它不发送电子邮件。当我尝试telnet localhost smtp
成功连接时,但是当我mail from:<steve@example.com>
按下Enter键时,它挂起了,什么也没发生。
查阅/var/log/mail.log
文件后,我发现,尝试连接到MySQL服务器时,问题可能出在后缀上(99%)。如果您看到下面给出的日志文件,则可以看到它显示为Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
。
Nov 14 21:54:36 ns1 dovecot: dovecot: Killed with signal 15 (by pid=7731 uid=0 code=kill)
Nov 14 21:54:36 ns1 dovecot: Dovecot v1.2.9 starting up (core dumps disabled)
Nov 14 21:54:36 ns1 dovecot: auth-worker(default): mysql: Connected to localhost (mailserver)
Nov 14 21:54:44 ns1 postfix/postfix-script[7753]: refreshing the Postfix mail system
Nov 14 21:54:44 ns1 postfix/master[1670]: reload -- version 2.7.0, configuration /etc/postfix
Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: fatal: mysql:/etc/postfix/mysql-virtual-alias-maps.cf(0,lock|fold_fix): table lookup problem
Nov 14 21:54:53 ns1 postfix/master[1670]: warning: process /usr/lib/postfix/trivial-rewrite pid 7759 exit status 1
Nov 14 21:54:53 ns1 postfix/cleanup[7397]: warning: problem talking to service rewrite: Connection reset by peer
Nov 14 21:54:53 ns1 postfix/master[1670]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Nov 14 21:54:53 ns1 postfix/smtpd[7071]: warning: problem talking to service rewrite: Success
我尝试了netstat -ln | grep mysql
它返回
unix 2 [ ACC ] STREAM LISTENING 5817 /var/run/mysqld/mysqld.sock
。
/etc/postfix/mysql-virtual-alias-maps.cf
文件的内容在这里:
user = stevejobs
password = apple
hosts = localhost
dbname = mailserver
query = SELECT destination FROM virtual_aliases WHERE source='%s'
在这里我试图改变,hosts = 127.0.0.1
但它说warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (110)
因此,我迷路了,不知道为了解决问题还需要在其他地方进行更改。任何帮助将不胜感激。
谢谢。
编辑1
当我执行netstat -na时,我看到mysql没有绑定到localhost也不绑定到127.0.0.1。也可能是问题吗?
bakhtiyor@ns1:~$ netstat -na | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN