Yesterday I set up a mail server following this tutorial and everything worked fine, but today I am unable to send or receive mails. When I want to send a mail with my support@example.com from Thunderbird it asks for my password then it doesn't accept it (I checked 3 different mail addresses).

postfix/pickup[15575]: 8724D2C411F5: uid=33 from=<www-data>
postfix/cleanup[16104]: 8724D2C411F5: message-id=<20130715165704.8724D2C411F5@Ubuntu-1204-precise-64-minimal.localdomain>
postfix/cleanup[16104]: warning: connect to mysql server Can't connect to MySQL server on '' (111)
warning  mysql: /etc/postfix/maps/alias.cf lookup error for "myname@gmail.com"
warning: A3C912C411F5: virtual_alias_maps map lookup problem for "myname@gmail.com" -- deferring delivery

This myname@gmail.com is my personal address.

ls -la /etc/postfix
drwxr-xr-x   4 root root  4096 Jul 14 11:06 .
drwxr-xr-x 124 root root 12288 Jul 14 22:51 ..
-rw-r--r--   1 root root   329 Jul 14 09:50 dynamicmaps.cf
-rw-r--r--   1 root root  1651 Jul 14 10:49 main.cf
-rw-r--r--   1 root root  1286 Jul 14 09:50 main.cf.default
drwxr-xr-x   2 root root  4096 Jul 15 18:42 maps
-rw-r--r--   1 root root  4798 Jul 14 09:57 master.cf
-rw-r--r--   1 root root  5531 Jul 14 09:50 master.cf.default
-rw-r--r--   1 root root 19707 Feb 20 21:03 postfix-files
-rwxr-xr-x   1 root root  8729 Feb 20 21:03 postfix-script
-rwxr-xr-x   1 root root 26498 Feb 20 21:03 post-install
drwxr-xr-x   2 root root  4096 Jul 14 10:07 sasl

ls -la /etc/postfix/maps
total 20
drwxr-xr-x 2 root    root    4096 Jul 15 18:42 .
drwxr-xr-x 4 root    root    4096 Jul 14 11:06 ..
-rwx------ 1 postfix postfix  158 Jul 15 18:42 alias.cf
-rwx------ 1 postfix postfix  170 Jul 14 10:05 domain.cf
-rwx------ 1 postfix postfix  235 Jul 14 10:05 user.cf



When I set in /etc/mysql/my.cnf the bind-address to I can send and receive emails but I cannot open my website:

ERROR: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'mywebsite.com' (111)

If I change it back to the IP address of the website, the website loads but then I cannot send or receive emails.

In /etc/hosts I have

my.ip.address www.example.com Ubuntu-1204-precise-64-minimal

If I comment out the bind-address parameter everything is working fine but I think that parameter is there for a reason. Any ideas?

  • Why do you not have your Postfix config and your website connecting to MySQL using the same IP address? – Ladadadada Jul 15 '13 at 18:21
  • What do you mean? What files and parameters should I check? Sorry, I am new to linux – erdomester Jul 15 '13 at 20:03

When you comment out the bind parameter mysql will bind to all interfaces. This leaves your mysql server exposed to the internet so If you need to have mysql listening on the internet facing interface because another remote server needs to use it then you can use iptables or hosts.allow to filter traffic to limit your attack surface.


As explained by @Shutupsquare, removing bind-address will make MySQL listen on all interfaces, including IP-address-of-mywebsite.com and loopback IP address

  • If your website reside on the same server of postfix, then it will be useful if you change MySQL parameter of your website so it will be connect to in instead connect to IP-address-of-mywebsite.com. Then set bind-address to It will prevent other host connect your MySQL because the MySQL only listen on loopback IP address.

  • If your website in the other host, then the firewall solution from @Shutupsquare will limit IP address that can connect to MySQL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.